aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/browser_harness.html29
-rw-r--r--tests/cases/aliasbitcastdollar.ll27
-rw-r--r--tests/cases/complexphi.ll4
-rw-r--r--tests/cases/emptystruct.ll21
-rw-r--r--tests/cases/frem.ll13
-rw-r--r--tests/cases/frem.txt1
-rw-r--r--tests/cases/quotedlabel.ll19
-rw-r--r--tests/cases/uadd_overflow.ll25
-rw-r--r--tests/cases/uadd_overflow.txt1
-rw-r--r--tests/cube2hash/Makefile14
-rw-r--r--tests/cube2hash/cube2crypto.c23
-rw-r--r--tests/cube2hash/cube2crypto.h9
-rw-r--r--tests/cube2hash/hashstring.cpp28
-rw-r--r--tests/cube2hash/readme.txt27
-rw-r--r--tests/cube2hash/tiger.c175
-rw-r--r--tests/cube2hash/tiger.h12
-rw-r--r--tests/cube2hash/util.h22
-rw-r--r--tests/emscripten_api_browser.cpp38
-rw-r--r--tests/env/output.txt2
-rw-r--r--tests/filesystem/src.js22
-rw-r--r--tests/freetype/main_2.c135
-rw-r--r--tests/freetype/main_3.c184
-rw-r--r--tests/freetype/ref_2.txt33
-rw-r--r--tests/freetype/ref_3.txt33
-rw-r--r--tests/freetype/ref_4.txt32
-rw-r--r--tests/gears.pngbin0 -> 7832 bytes
-rw-r--r--tests/gl/LICENSE.TXT11
-rw-r--r--tests/gl/sdl_ogl.c202
-rw-r--r--tests/gl/tutorial2.frag11
-rw-r--r--tests/gl/tutorial2.vert19
-rw-r--r--tests/glbook/CH02_HelloTriangle.pngbin0 -> 1009 bytes
-rw-r--r--tests/glbook/CH08_SimpleVertexShader.pngbin0 -> 1600 bytes
-rw-r--r--tests/glbook/CH09_SimpleTexture2D.pngbin0 -> 1943 bytes
-rw-r--r--tests/glbook/CH09_TextureCubemap.pngbin0 -> 3209 bytes
-rw-r--r--tests/glbook/CH09_TextureWrap.pngbin0 -> 1812 bytes
-rw-r--r--tests/glbook/CH10_MultiTexture.pngbin0 -> 59495 bytes
-rw-r--r--tests/glbook/CH13_ParticleSystem.pngbin0 -> 11936 bytes
-rw-r--r--tests/glbook/Chapter_10/MultiTexture/MultiTexture.c227
-rw-r--r--tests/glbook/Chapter_10/MultiTexture/MultiTexture_orig.c213
-rw-r--r--tests/glbook/Chapter_10/MultiTexture/basemap.tgabin0 -> 786476 bytes
-rw-r--r--tests/glbook/Chapter_10/MultiTexture/lightmap.tgabin0 -> 196626 bytes
-rw-r--r--tests/glbook/Chapter_11/Multisample/Multisample.c302
-rw-r--r--tests/glbook/Chapter_11/Stencil_Test/Stencil_Test.c273
-rw-r--r--tests/glbook/Chapter_13/ParticleSystem/ParticleSystem.c310
-rw-r--r--tests/glbook/Chapter_13/ParticleSystem/ParticleSystem_orig.c294
-rw-r--r--tests/glbook/Chapter_13/ParticleSystem/smoke.tgabin0 -> 49170 bytes
-rw-r--r--tests/glbook/Chapter_15/Hello_Triangle_KD/Hello_Triangle_KD.c306
-rw-r--r--tests/glbook/Chapter_2/Hello_Triangle/Hello_Triangle.c200
-rw-r--r--tests/glbook/Chapter_2/Hello_Triangle/Hello_Triangle_orig.c193
-rw-r--r--tests/glbook/Chapter_8/Simple_VertexShader/Simple_VertexShader.c209
-rw-r--r--tests/glbook/Chapter_8/Simple_VertexShader/Simple_VertexShader_orig.c196
-rw-r--r--tests/glbook/Chapter_9/MipMap2D/MipMap2D.c348
-rw-r--r--tests/glbook/Chapter_9/Simple_Texture2D/Simple_Texture2D.c213
-rw-r--r--tests/glbook/Chapter_9/Simple_Texture2D/Simple_Texture2D_orig.c199
-rw-r--r--tests/glbook/Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap.c244
-rw-r--r--tests/glbook/Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap_orig.c227
-rw-r--r--tests/glbook/Chapter_9/TextureWrap/TextureWrap.c275
-rw-r--r--tests/glbook/Chapter_9/TextureWrap/TextureWrap_orig.c257
-rw-r--r--tests/glbook/Common/esShader.c155
-rw-r--r--tests/glbook/Common/esShapes.c280
-rw-r--r--tests/glbook/Common/esTransform.c213
-rw-r--r--tests/glbook/Common/esUtil.c420
-rw-r--r--tests/glbook/Common/esUtil.h281
-rw-r--r--tests/glbook/Makefile60
-rw-r--r--tests/glbook/README.linux32
-rw-r--r--tests/hello_world.js4
-rw-r--r--tests/hello_world_file.cpp13
-rw-r--r--tests/hello_world_file.txt4
-rw-r--r--tests/hello_world_gles.c19
-rw-r--r--tests/hello_world_gles_deriv.c730
-rw-r--r--tests/hello_world_gles_shell.html2
-rw-r--r--tests/hello_world_sdl.cpp5
-rw-r--r--tests/htmltest.pngbin0 -> 743 bytes
-rw-r--r--tests/i64_precise.txt128
-rw-r--r--tests/python/ccproxy.py2
-rwxr-xr-xtests/runner.py1500
-rw-r--r--tests/screenshot-gray.pngbin0 -> 203336 bytes
-rw-r--r--tests/screenshot.jpgbin0 -> 50759 bytes
-rw-r--r--tests/screenshot.pngbin0 -> 329895 bytes
-rw-r--r--tests/screenshot2.pngbin0 -> 203164 bytes
-rw-r--r--tests/sdl_audio.c50
-rw-r--r--tests/sdl_canvas.c50
-rw-r--r--tests/sdl_gl_read.c155
-rw-r--r--tests/sdl_image.c35
-rw-r--r--tests/sdl_key.c55
-rw-r--r--tests/sdl_mouse.c62
-rw-r--r--tests/sdl_ogl.c155
-rw-r--r--tests/sdl_ogl_p.c164
-rw-r--r--tests/sounds/LICENSE.txt19
-rw-r--r--tests/sounds/alarmcreatemiltaryfoot_1.wavbin0 -> 443856 bytes
-rw-r--r--tests/sounds/alarmvictory_1.oggbin0 -> 56490 bytes
-rw-r--r--tests/time/output.txt4
-rw-r--r--tests/unistd/io.js2
-rw-r--r--tests/unistd/isatty.out10
94 files changed, 9716 insertions, 551 deletions
diff --git a/tests/browser_harness.html b/tests/browser_harness.html
new file mode 100644
index 00000000..86f3749f
--- /dev/null
+++ b/tests/browser_harness.html
@@ -0,0 +1,29 @@
+<html>
+<head>
+ <title>Emscripten Browser Test Harness</title>
+</head>
+<body>
+<h2><b>Running tests...</b></h2>
+<div id="output"></div>
+<script>
+ var counter = 0;
+ function check() {
+ var request = new XMLHttpRequest();
+ request.open('GET', '/check', false);
+ try {
+ request.send(null);
+ if (request.responseText != 'False') {
+ window.open(request.responseText);
+ document.getElementById('output').innerHTML += 'opened test window ' + (counter++) + '..<br>';
+ }
+ setTimeout(check, 333);
+ } catch(e) {
+ document.write('Tests complete. View log in console.');
+ return;
+ }
+ }
+ check();
+</script>
+</body>
+</html>
+
diff --git a/tests/cases/aliasbitcastdollar.ll b/tests/cases/aliasbitcastdollar.ll
new file mode 100644
index 00000000..1ecf6047
--- /dev/null
+++ b/tests/cases/aliasbitcastdollar.ll
@@ -0,0 +1,27 @@
+; ModuleID = '/tmp/emscripten/tmp/src.cpp.o'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
+target triple = "i386-pc-linux-gnu"
+
+@.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1]
+
+@"other$name" = alias bitcast (void ()* @original to void (i32)*) ; [#uses=1]
+
+; [#uses=2]
+define void @original() {
+entry:
+ %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
+ br label %return
+
+return: ; preds = %entry
+ ret void
+}
+
+; [#uses=1]
+declare i32 @puts(i8*)
+
+; [#uses=0]
+define i32 @main() {
+entry:
+ call void @"other$name"(i32 5)
+ ret i32 0
+}
diff --git a/tests/cases/complexphi.ll b/tests/cases/complexphi.ll
index 6f64af06..fcb7185f 100644
--- a/tests/cases/complexphi.ll
+++ b/tests/cases/complexphi.ll
@@ -3,6 +3,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
target triple = "i386-pc-linux-gnu"
@.str = private unnamed_addr constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1 type=[15 x i8]*]
+@_dispatchTable = internal global i64 0
; [#uses=0]
define i32 @main() {
@@ -19,6 +20,9 @@ cond.null:
cond.end: ; preds = %cond.false, %cond.true
%cond = phi { i32, i32 } [ { i32 5, i32 6 }, %entry ], [ zeroinitializer, %cond.null ] ; [#uses=1]
store { i32, i32 } %cond, { i32, i32 }* %comp
+
+ store { i32, i32 } { i32 ptrtoint (i64* @_dispatchTable to i32), i32 0 }, { i32, i32 }* getelementptr inbounds ([1 x i64]* @_dispatchTable, i32 0, i32 0, i32 1), align 4
+
ret i32 0 ; [debug line = 6:13]
}
diff --git a/tests/cases/emptystruct.ll b/tests/cases/emptystruct.ll
new file mode 100644
index 00000000..d4165fdd
--- /dev/null
+++ b/tests/cases/emptystruct.ll
@@ -0,0 +1,21 @@
+; ModuleID = 'emptystruct.c'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
+target triple = "i386-pc-linux-gnu"
+
+%struct.s = type { {}, i32 }
+
+@.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1]
+
+define i32 @main() nounwind {
+entry:
+ %z = alloca %struct.s, align 4
+ %0 = bitcast %struct.s* %z to i8*
+ call void @llvm.memset.p0i8.i32(i8* %0, i8 0, i32 4, i32 4, i1 false)
+ %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
+ ret i32 0
+}
+
+declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
+
+declare i32 @puts(i8*)
+
diff --git a/tests/cases/frem.ll b/tests/cases/frem.ll
new file mode 100644
index 00000000..442cd04c
--- /dev/null
+++ b/tests/cases/frem.ll
@@ -0,0 +1,13 @@
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
+target triple = "i386-pc-linux-gnu"
+
+@.str2 = private constant [6 x i8] c"*%f*\0A\00", align 1 ; [#uses=1]
+
+declare i32 @printf(i8* noalias, ...) nounwind
+
+define i32 @main() {
+entry:
+ %c = frem double 2.5, 1.0
+ %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]* @.str2, i32 0, i32 0), double %c)
+ ret i32 0
+}
diff --git a/tests/cases/frem.txt b/tests/cases/frem.txt
new file mode 100644
index 00000000..3a7ecb6a
--- /dev/null
+++ b/tests/cases/frem.txt
@@ -0,0 +1 @@
+*0.500000*
diff --git a/tests/cases/quotedlabel.ll b/tests/cases/quotedlabel.ll
new file mode 100644
index 00000000..d32e380a
--- /dev/null
+++ b/tests/cases/quotedlabel.ll
@@ -0,0 +1,19 @@
+; ModuleID = '/tmp/emscripten/tmp/src.cpp.o'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
+target triple = "i386-pc-linux-gnu"
+
+@.str = private constant [14 x i8] c"hello, world!\00", align 1 ; [#uses=1]
+
+; [#uses=1]
+declare i32 @puts(i8*)
+
+; [#uses=0]
+define i32 @main() {
+entry:
+ br label %"finish$$$"
+
+"finish$$$": ; preds = %entry
+ %0 = call i32 bitcast (i32 (i8*)* @puts to i32 (i32*)*)(i8* getelementptr inbounds ([14 x i8]* @.str, i32 0, i32 0)) ; [#uses=0]
+ ret i32 0
+}
+
diff --git a/tests/cases/uadd_overflow.ll b/tests/cases/uadd_overflow.ll
new file mode 100644
index 00000000..a808b9de
--- /dev/null
+++ b/tests/cases/uadd_overflow.ll
@@ -0,0 +1,25 @@
+; ModuleID = 'tests/hello_world.bc'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
+target triple = "i386-pc-linux-gnu"
+
+@.str2 = private constant [9 x i8] c"*%d,%d*\0A\00", align 1 ; [#uses=1]
+
+; [#uses=0]
+define i32 @main() {
+entry:
+ %retval = alloca i32, align 4 ; [#uses=1 type=i32*]
+ %mul7 = bitcast i32 -259741926 to i32
+ %shl10 = shl i32 4014, 16
+ %uadd1 = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %mul7, i32 %shl10)
+ %a0 = extractvalue { i32, i1 } %uadd1, 0
+ %a1 = extractvalue { i32, i1 } %uadd1, 1
+ %a2 = zext i1 %a1 to i32
+ call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str2, i32 0, i32 0), i32 %a0, i32 %a2) ; [#uses=0]
+ ret i32 1
+}
+
+; [#uses=1]
+declare i32 @printf(i8*, ...)
+
+declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32) nounwind readnone
+
diff --git a/tests/cases/uadd_overflow.txt b/tests/cases/uadd_overflow.txt
new file mode 100644
index 00000000..dcda9240
--- /dev/null
+++ b/tests/cases/uadd_overflow.txt
@@ -0,0 +1 @@
+*3319578,1*
diff --git a/tests/cube2hash/Makefile b/tests/cube2hash/Makefile
new file mode 100644
index 00000000..5d0a7a63
--- /dev/null
+++ b/tests/cube2hash/Makefile
@@ -0,0 +1,14 @@
+all: cube2hash.bc
+
+cube2hash.bc: cube2crypto.o tiger.o hashstring.o
+ $(CXX) $^ -o $@
+
+hashstring.o: hashstring.cpp
+ $(CXX) -c $^ -o $@
+
+cube2crypto.o: cube2crypto.c cube2crypto.h
+ $(CC) -c $< -o $@
+
+tiger.o: tiger.c tiger.h
+ $(CC) -c $< -o $@
+
diff --git a/tests/cube2hash/cube2crypto.c b/tests/cube2hash/cube2crypto.c
new file mode 100644
index 00000000..52613318
--- /dev/null
+++ b/tests/cube2hash/cube2crypto.c
@@ -0,0 +1,23 @@
+#include <stdlib.h>
+#include "util.h"
+#include "tiger.h"
+#include "cube2crypto.h"
+
+char *cube2crypto_hashstring(char *string)
+{
+ char *result = (char *)malloc(49);
+ union hashval hv;
+
+ tiger_hash((uchar *)string, strlen(string), &hv);
+
+ int i;
+ for(i = 0; i < sizeof(hv.bytes); i++)
+ {
+ uchar c = hv.bytes[i];
+ *(result+(i*2)) = "0123456789ABCDEF"[c&0xF];
+ *(result+(i*2)+1) = "0123456789ABCDEF"[c>>4];
+ }
+ *(result+(i*2)+2) = '\0';
+
+ return result;
+}
diff --git a/tests/cube2hash/cube2crypto.h b/tests/cube2hash/cube2crypto.h
new file mode 100644
index 00000000..90bd06a8
--- /dev/null
+++ b/tests/cube2hash/cube2crypto.h
@@ -0,0 +1,9 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *cube2crypto_hashstring(char *string);
+
+#ifdef __cplusplus
+} /* closing brace for extern "C" */
+#endif \ No newline at end of file
diff --git a/tests/cube2hash/hashstring.cpp b/tests/cube2hash/hashstring.cpp
new file mode 100644
index 00000000..b08d5d5e
--- /dev/null
+++ b/tests/cube2hash/hashstring.cpp
@@ -0,0 +1,28 @@
+#include "cube2crypto.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+void help()
+{
+ printf("Usage: hashstring <seed>\n");
+}
+
+int main(int argc, char **argv)
+{
+ if(argc != 2 || !argv[1])
+ {
+ help();
+ return EXIT_FAILURE;
+ }
+
+ char *answer = cube2crypto_hashstring(argv[1]);
+
+ printf("hash value: %s\n", answer);
+
+ free(answer);
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/cube2hash/readme.txt b/tests/cube2hash/readme.txt
new file mode 100644
index 00000000..6eb129c2
--- /dev/null
+++ b/tests/cube2hash/readme.txt
@@ -0,0 +1,27 @@
+This directory contains zlib code (c) the Cube 2/Sauerbraten project.
+http://sauerbraten.org/
+
+LICENSE
+=======
+
+Sauerbraten game engine source code, any release.
+
+Copyright (C) 2001-2009 Wouter van Oortmerssen, Lee Salzman, Mike Dysart, Robert Pointon, and Quinton Reeves
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+
+
diff --git a/tests/cube2hash/tiger.c b/tests/cube2hash/tiger.c
new file mode 100644
index 00000000..f8707248
--- /dev/null
+++ b/tests/cube2hash/tiger.c
@@ -0,0 +1,175 @@
+///////////////////////// cryptography /////////////////////////////////
+
+/* Based off the reference implementation of Tiger, a cryptographically
+ * secure 192 bit hash function by Ross Anderson and Eli Biham. More info at:
+ * http://www.cs.technion.ac.il/~biham/Reports/Tiger/
+ */
+
+#define TIGER_PASSES 3
+
+#include "tiger.h"
+#include "util.h"
+
+chunk sboxes[4*256];
+
+#define sb1 (sboxes)
+#define sb2 (sboxes+256)
+#define sb3 (sboxes+256*2)
+#define sb4 (sboxes+256*3)
+
+#define round(a, b, c, x) \
+ c ^= x; \
+ a -= sb1[((c)>>(0*8))&0xFF] ^ sb2[((c)>>(2*8))&0xFF] ^ \
+ sb3[((c)>>(4*8))&0xFF] ^ sb4[((c)>>(6*8))&0xFF] ; \
+ b += sb4[((c)>>(1*8))&0xFF] ^ sb3[((c)>>(3*8))&0xFF] ^ \
+ sb2[((c)>>(5*8))&0xFF] ^ sb1[((c)>>(7*8))&0xFF] ; \
+ b *= mul;
+
+void tiger_compress(const chunk *str, chunk state[3])
+{
+ chunk a, b, c;
+ chunk aa, bb, cc;
+ chunk x0, x1, x2, x3, x4, x5, x6, x7;
+
+ a = state[0];
+ b = state[1];
+ c = state[2];
+
+ x0=str[0]; x1=str[1]; x2=str[2]; x3=str[3];
+ x4=str[4]; x5=str[5]; x6=str[6]; x7=str[7];
+
+ aa = a;
+ bb = b;
+ cc = c;
+
+ int pass;
+
+ for(pass = 0; pass < TIGER_PASSES; pass++)
+ {
+ if(pass)
+ {
+ x0 -= x7 ^ 0xA5A5A5A5A5A5A5A5ULL; x1 ^= x0; x2 += x1; x3 -= x2 ^ ((~x1)<<19);
+ x4 ^= x3; x5 += x4; x6 -= x5 ^ ((~x4)>>23); x7 ^= x6;
+ x0 += x7; x1 -= x0 ^ ((~x7)<<19); x2 ^= x1; x3 += x2;
+ x4 -= x3 ^ ((~x2)>&g