diff options
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-x | tests/runner.py | 553 |
1 files changed, 474 insertions, 79 deletions
diff --git a/tests/runner.py b/tests/runner.py index 427b9c63..86e97b19 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -904,26 +904,26 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv) and 'brows void interface_clock_changed() { - UINT8 m_divshift; - INT32 m_divisor; + UINT8 m_divshift; + INT32 m_divisor; - //INT64 attos = m_attoseconds_per_cycle; - INT64 attos = 279365114840; - m_divshift = 0; - while (attos >= (1UL << 31)) - { - m_divshift++; - printf("m_divshift is %i, on %Ld >?= %lu\n", m_divshift, attos, 1UL << 31); - attos >>= 1; - } - m_divisor = attos; + //INT64 attos = m_attoseconds_per_cycle; + INT64 attos = 279365114840; + m_divshift = 0; + while (attos >= (1UL << 31)) + { + m_divshift++; + printf("m_divshift is %i, on %Ld >?= %lu\n", m_divshift, attos, 1UL << 31); + attos >>= 1; + } + m_divisor = attos; - printf("m_divisor is %i\n",m_divisor); + printf("m_divisor is %i\n",m_divisor); } int main() { - interface_clock_changed(); - return 0; + interface_clock_changed(); + return 0; } ''' self.do_run(src, '''m_divshift is 1, on 279365114840 >?= 2147483648 @@ -997,8 +997,8 @@ m_divisor is 1091269979 volatile UINT64 testu64a = 14746250828952703000U; while ((UINT64)testu32a * (UINT64)bigu32 < testu64a) { - printf("testu64a is %llu\n", testu64a); - testu64a /= 2; + printf("testu64a is %llu\n", testu64a); + testu64a /= 2; } return 0; @@ -1456,28 +1456,28 @@ c5,de,15,8a quint64 v = strtoull("4433ffeeddccbb00", NULL, 16); printf("%lld\n", v); - const string string64bitInt = "4433ffeeddccbb00"; - stringstream s(string64bitInt); - quint64 int64bitInt = 0; + const string string64bitInt = "4433ffeeddccbb00"; + stringstream s(string64bitInt); + quint64 int64bitInt = 0; printf("1\n"); - s >> hex >> int64bitInt; + s >> hex >> int64bitInt; printf("2\n"); - stringstream out; - out << hex << qbswap(int64bitInt); + stringstream out; + out << hex << qbswap(int64bitInt); - cout << out.str() << endl; - cout << hex << int64bitInt << endl; - cout << string64bitInt << endl; + cout << out.str() << endl; + cout << hex << int64bitInt << endl; + cout << string64bitInt << endl; - if (out.str() != "bbccddeeff3344") - { - cout << "Failed!" << endl; - } - else - { - cout << "Succeeded!" << endl; - } + if (out.str() != "bbccddeeff3344") + { + cout << "Failed!" << endl; + } + else + { + cout << "Succeeded!" << endl; + } return 0; } @@ -1916,6 +1916,47 @@ Succeeded! expected = open(path_from_root('tests', 'hyperbolic', 'output.txt'), 'r').read() self.do_run(src, expected) + def test_frexp(self): + src = ''' + #include <stdio.h> + #include <math.h> + #include <assert.h> + + static const double tol=1e-16; + + void test_value(double value) + { + int exponent; + double x=frexp(value, &exponent); + double expected=x*pow(2.0, exponent); + + printf("%f=%f*2^%d\\n", value, x, exponent); + + assert(fabs(expected-value)<tol); + assert(x==0 || (fabs(x)>=5e-1 && fabs(x)<1)); // x has a magnitude in the interval [1/2, 1) + } + + int main() + { + test_value(0); + test_value(100.1); + test_value(-100.1); + test_value(.5); + test_value(-.5); + test_value(1-1e-16); + test_value(-(1-1e-16)); + + return 0; + } + ''' + self.do_run(src, '''0.000000=0.000000*2^0 +100.100000=0.782031*2^7 +-100.100000=-0.782031*2^7 +0.500000=0.500000*2^0 +-0.500000=-0.500000*2^0 +1.000000=1.000000*2^0 +-1.000000=-1.000000*2^0''') + def test_getgep(self): # Generated code includes getelementptr (getelementptr, 0, 1), i.e., GEP as the first param to GEP src = ''' @@ -3029,6 +3070,28 @@ setjmp exception execution path, level: 0, prev_jmp: -1 Exiting setjmp function, level: 0, prev_jmp: -1 ''') + def test_std_exception(self): + if self.emcc_args is None: return self.skip('requires emcc') + Settings.DISABLE_EXCEPTION_CATCHING = 0 + self.emcc_args += ['-s', 'SAFE_HEAP=0'] + + src = r''' + #include <stdio.h> + #include <exception> + + int main() + { + std::exception e; + try { + throw e; + } catch(std::exception e) { + printf("caught std::exception\n"); + } + return 0; + } + ''' + self.do_run(src, 'caught std::exception') + def test_exit_stack(self): if self.emcc_args is None: return self.skip('requires emcc') if Settings.ASM_JS: return self.skip('uses report_stack without exporting') @@ -4008,15 +4071,15 @@ def process(filename): // see related things in openjpeg typedef struct opj_mqc_state { - unsigned int qeval; - int mps; - struct opj_mqc_state *nmps; - struct opj_mqc_state *nlps; + unsigned int qeval; + int mps; + struct opj_mqc_state *nmps; + struct opj_mqc_state *nlps; } opj_mqc_state_t; static opj_mqc_state_t mqc_states[2] = { - {0x5600, 0, &mqc_states[2], &mqc_states[3]}, - {0x5602, 1, &mqc_states[3], &mqc_states[2]}, + {0x5600, 0, &mqc_states[2], &mqc_states[3]}, + {0x5602, 1, &mqc_states[3], &mqc_states[2]}, }; int main() { @@ -4071,7 +4134,7 @@ def process(filename): int main( int argc, const char *argv[] ) { unsigned int x = 0xfffffff1; - x >>= 0; // force it to be unsigned for purpose of checking our switch comparison in signed/unsigned + x >>= (argc-1); // force it to be unsigned for purpose of checking our switch comparison in signed/unsigned printf("*%d,%d,%d,%d,%d,%d*\\n", switcher('a'), switcher('b'), switcher('c'), switcher(x), switcher(-15), switcher('e')); return 0; } @@ -4510,6 +4573,212 @@ The current type of b is: 9 self.do_run(src, '*1*', force_c=True) + def test_strtoll_hex(self): + if self.emcc_args is None: return self.skip('requires emcc') + + # tests strtoll for hex strings (0x...) + src = r''' + #include <stdio.h> + #include <stdlib.h> + + int main() { + const char *STRING = "0x4 -0x3A +0xDEADBEEF"; + char *end_char; + + // undefined base + long long int l1 = strtoll(STRING, &end_char, 0); + long long int l2 = strtoll(end_char, &end_char, 0); + long long int l3 = strtoll(end_char, NULL, 0); + + // defined base + long long int l4 = strtoll(STRING, &end_char, 16); + long long int l5 = strtoll(end_char, &end_char, 16); + long long int l6 = strtoll(end_char, NULL, 16); + + printf("%d%d%d%d%d%d\n", l1==0x4, l2==-0x3a, l3==0xdeadbeef, l4==0x4, l5==-0x3a, l6==0xdeadbeef); + return 0; + } + ''' + self.do_run(src, '111111') + + def test_strtoll_dec(self): + if self.emcc_args is None: return self.skip('requires emcc') + + # tests strtoll for decimal strings (0x...) + src = r''' + #include <stdio.h> + #include <stdlib.h> + + int main() { + const char *STRING = "4 -38 +4711"; + char *end_char; + + // undefined base + long long int l1 = strtoll(STRING, &end_char, 0); + long long int l2 = strtoll(end_char, &end_char, 0); + long long int l3 = strtoll(end_char, NULL, 0); + + // defined base + long long int l4 = strtoll(STRING, &end_char, 10); + long long int l5 = strtoll(end_char, &end_char, 10); + long long int l6 = strtoll(end_char, NULL, 10); + + printf("%d%d%d%d%d%d\n", l1==4, l2==-38, l3==4711, l4==4, l5==-38, l6==4711); + return 0; + } + ''' + self.do_run(src, '111111') + + def test_strtoll_bin(self): + if self.emcc_args is None: return self.skip('requires emcc') + + # tests strtoll for binary strings (0x...) + src = r''' + #include <stdio.h> + #include <stdlib.h> + + int main() { + const char *STRING = "1 -101 +1011"; + char *end_char; + + // defined base + long long int l4 = strtoll(STRING, &end_char, 2); + long long int l5 = strtoll(end_char, &end_char, 2); + long long int l6 = strtoll(end_char, NULL, 2); + + printf("%d%d%d\n", l4==1, l5==-5, l6==11); + return 0; + } + ''' + self.do_run(src, '111') + + def test_strtoll_oct(self): + if self.emcc_args is None: return self.skip('requires emcc') + + # tests strtoll for decimal strings (0x...) + src = r''' + #include <stdio.h> + #include <stdlib.h> + + int main() { + const char *STRING = "0 -035 +04711"; + char *end_char; + + // undefined base + long long int l1 = strtoll(STRING, &end_char, 0); + long long int l2 = strtoll(end_char, &end_char, 0); + long long int l3 = strtoll(end_char, NULL, 0); + + // defined base + long long int l4 = strtoll(STRING, &end_char, 8); + long long int l5 = strtoll(end_char, &end_char, 8); + long long int l6 = strtoll(end_char, NULL, 8); + + printf("%d%d%d%d%d%d\n", l1==0, l2==-29, l3==2505, l4==0, l5==-29, l6==2505); + return 0; + } + ''' + self.do_run(src, '111111') + + def test_strtol_hex(self): + # tests strtoll for hex strings (0x...) + src = r''' + #include <stdio.h> + #include <stdlib.h> + + int main() { + const char *STRING = "0x4 -0x3A +0xDEAD"; + char *end_char; + + // undefined base + long l1 = strtol(STRING, &end_char, 0); + long l2 = strtol(end_char, &end_char, 0); + long l3 = strtol(end_char, NULL, 0); + + // defined base + long l4 = strtol(STRING, &end_char, 16); + long l5 = strtol(end_char, &end_char, 16); + long l6 = strtol(end_char, NULL, 16); + + printf("%d%d%d%d%d%d\n", l1==0x4, l2==-0x3a, l3==0xdead, l4==0x4, l5==-0x3a, l6==0xdead); + return 0; + } + ''' + self.do_run(src, '111111') + + def test_strtol_dec(self): + # tests strtoll for decimal strings (0x...) + src = r''' + #include <stdio.h> + #include <stdlib.h> + + int main() { + const char *STRING = "4 -38 +4711"; + char *end_char; + + // undefined base + long l1 = strtol(STRING, &end_char, 0); + long l2 = strtol(end_char, &end_char, 0); + long l3 = strtol(end_char, NULL, 0); + + // defined base + long l4 = strtol(STRING, &end_char, 10); + long l5 = strtol(end_char, &end_char, 10); + long l6 = strtol(end_char, NULL, 10); + + printf("%d%d%d%d%d%d\n", l1==4, l2==-38, l3==4711, l4==4, l5==-38, l6==4711); + return 0; + } + ''' + self.do_run(src, '111111') + + def test_strtol_bin(self): + # tests strtoll for binary strings (0x...) + src = r''' + #include <stdio.h> + #include <stdlib.h> + + int main() { + const char *STRING = "1 -101 +1011"; + char *end_char; + + // defined base + long l4 = strtol(STRING, &end_char, 2); + long l5 = strtol(end_char, &end_char, 2); + long l6 = strtol(end_char, NULL, 2); + + printf("%d%d%d\n", l4==1, l5==-5, l6==11); + return 0; + } + ''' + self.do_run(src, '111') + + def test_strtol_oct(self): + # tests strtoll for decimal strings (0x...) + src = r''' + #include <stdio.h> + #include <stdlib.h> + + int main() { + const char *STRING = "0 -035 +04711"; + char *end_char; + + // undefined base + long l1 = strtol(STRING, &end_char, 0); + long l2 = strtol(end_char, &end_char, 0); + long l3 = strtol(end_char, NULL, 0); + + // defined base + long l4 = strtol(STRING, &end_char, 8); + long l5 = strtol(end_char, &end_char, 8); + long l6 = strtol(end_char, NULL, 8); + + printf("%d%d%d%d%d%d\n", l1==0, l2==-29, l3==2505, l4==0, l5==-29, l6==2505); + return 0; + } + ''' + self.do_run(src, '111111') + def test_atexit(self): # Confirms they are called in reverse order src = r''' @@ -4587,25 +4856,25 @@ The current type of b is: 9 typedef struct { - int (*f)(void *); - void *d; - char s[16]; + int (*f)(void *); + void *d; + char s[16]; } LMEXFunctionStruct; int f(void *user) { - return 0; + return 0; } static LMEXFunctionStruct const a[] = { - {f, (void *)(int)'a', "aa"} + {f, (void *)(int)'a', "aa"} }; int main() { printf("ok\n"); - return a[0].f(a[0].d); + return a[0].f(a[0].d); } ''' self.do_run(src, 'ok\n') @@ -6604,7 +6873,7 @@ def process(filename): printf("f_blocks: %lu\n", s.f_blocks); printf("f_bfree: %lu\n", s.f_bfree); printf("f_bavail: %lu\n", s.f_bavail); - printf("f_files: %lu\n", s.f_files); + printf("f_files: %d\n", s.f_files > 5); printf("f_ffree: %lu\n", s.f_ffree); printf("f_favail: %lu\n", s.f_favail); printf("f_fsid: %lu\n", s.f_fsid); @@ -6622,7 +6891,7 @@ def process(filename): f_blocks: 1000000 f_bfree: 500000 f_bavail: 500000 - f_files: 10 + f_files: 1 f_ffree: 1000000 f_favail: 1000000 f_fsid: 42 @@ -8605,9 +8874,43 @@ def process(filename): open('dead_funcs', 'w').write(pgo_output[pgo_output.find('['):-1]) self.emcc_args += ['-s', 'DEAD_FUNCTIONS=@' + self.in_dir('dead_funcs')] self.do_run(src, output) + self.emcc_args.pop() + self.emcc_args.pop() shutil.move(self.in_dir('src.cpp.o.js'), self.in_dir('pgoed2.js')) assert open('pgoed.js').read() == open('pgoed2.js').read() + # with relative response in settings element itself + + open('dead_funcs', 'w').write(pgo_output[pgo_output.find('['):-1]) + self.emcc_args += ['-s', 'DEAD_FUNCTIONS=@dead_funcs'] + self.do_run(src, output) + self.emcc_args.pop() + self.emcc_args.pop() + shutil.move(self.in_dir('src.cpp.o.js'), self.in_dir('pgoed2.js')) + assert open('pgoed.js').read() == open('pgoed2.js').read() + + def test_exported_response(self): + if self.emcc_args is None: return self.skip('requires emcc') + + src = r''' + #include <stdio.h> + #include <stdlib.h> + + extern "C" { + int other_function() { return 5; } + } + + int main() { + printf("waka!\n"); + return 0; + } + ''' + open('exps', 'w').write('["_main","_other_function"]') + + self.emcc_args += ['-s', 'EXPORTED_FUNCTIONS=@exps'] + self.do_run(src, '''waka!''') + assert 'other_function' in open('src.cpp.o.js').read() + def test_add_function(self): if self.emcc_args is None: return self.skip('requires emcc') @@ -8647,6 +8950,28 @@ def process(filename): Settings.ALIASING_FUNCTION_POINTERS = 1 - Settings.ALIASING_FUNCTION_POINTERS # flip the test self.do_run(src, '''Hello 7 from JS!''') + def test_embind(self): + if self.emcc_args is None: return self.skip('requires emcc') + Building.COMPILER_TEST_OPTS += ['--bind'] + + src = r''' + #include<stdio.h> + #include<emscripten/val.h> + + using namespace emscripten; + + int main() { + val Math = val::global("Math"); + + // two ways to call Math.abs + printf("abs(-10): %d\n", Math.call<int>("abs", -10)); + printf("abs(-11): %d\n", Math["abs"](-11).as<int>()); + + return 0; + } + ''' + self.do_run(src, 'abs(-10): 10\nabs(-11): 11'); + def test_scriptaclass(self): if self.emcc_args is None: return self.skip('requires emcc') @@ -10031,6 +10356,8 @@ f.close() assert not os.path.exists('a.out') and not os.path.exists('a.exe'), 'Must not leave unneeded linker stubs' def test_symlink(self): + if os.name == 'nt': + return self.skip('Windows FS does not need to be tested for symlinks support, since it does not have them.') open(os.path.join(self.get_dir(), 'foobar.xxx'), 'w').write('int main(){ return 0; }') os.symlink(os.path.join(self.get_dir(), 'foobar.xxx'), os.path.join(self.get_dir(), 'foobar.c')) Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'foobar.c'), '-o', os.path.join(self.get_dir(), 'foobar')], stdout=PIPE, stderr=PIPE).communicate() @@ -10185,8 +10512,8 @@ f.close() #define _TESTA_H_ class TestA { - public: - TestA(); + public: + TestA(); }; #endif @@ -10196,8 +10523,8 @@ f.close() #define _TESTB_H_ class TestB { - public: - TestB(); + public: + TestB(); }; #endif @@ -10207,7 +10534,7 @@ f.close() #include <testa.h> TestA::TestA() { - printf("TestA\n"); + printf("TestA\n"); } ''') open('testb.cpp', 'w').write(r''' @@ -10217,8 +10544,8 @@ f.close() /* */ TestB::TestB() { - printf("TestB\n"); - TestA* testa = new TestA(); + printf("TestB\n"); + TestA* testa = new TestA(); } ''') open('main.cpp', 'w').write(r''' @@ -10229,9 +10556,9 @@ f.close() /* */ int main(int argc, char** argv) { - printf("Main\n"); - TestA* testa = new TestA(); - TestB* testb = new TestB(); + printf("Main\n"); + TestA* testa = new TestA(); + TestB* testb = new TestB(); } ''') @@ -11438,7 +11765,9 @@ elif 'browser' in str(sys.argv): self.run_browser('page.html', '', '/report_result?1') def test_preload_file(self): - open(os.path.join(self.get_dir(), 'somefile.txt'), 'w').write('''load me right before running the code please''') + absolute_src_path = os.path.join(self.get_dir(), 'somefile.txt').replace('\\', '/') + open(absolute_src_path, 'w').write('''load me right before running the code please''') + def make_main(path): print path open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(self.with_report_result(r''' @@ -11457,26 +11786,92 @@ elif 'browser' in str(sys.argv): REPORT_RESULT(); return 0; } - ''' % path)) - - make_main('somefile.txt') - Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--preload-file', 'somefile.txt', '-o', 'page.html']).communicate() - self.run_browser('page.html', 'You should see |load me right before|.', '/report_result?1') + ''' % path)) + + test_cases = [ + # (source preload-file string, file on target FS to load) + ("somefile.txt", "somefile.txt"), + ("./somefile.txt", "somefile.txt"), + ("somefile.txt@file.txt", "file.txt"), + ("./somefile.txt@file.txt", "file.txt"), + ("./somefile.txt@./file.txt", "file.txt"), + ("somefile.txt@/file.txt", "file.txt"), + ("somefile.txt@/", "somefile.txt"), + (absolute_src_path + "@file.txt", "file.txt"), + (absolute_src_path + "@/file.txt", "file.txt"), + (absolute_src_path + "@/", "somefile.txt"), + ("somefile.txt@/directory/file.txt", "/directory/file.txt"), + ("somefile.txt@/directory/file.txt", "directory/file.txt"), + (absolute_src_path + "@/directory/file.txt", "directory/file.txt")] + + for test in test_cases: + (srcpath, dstpath) = test + make_main(dstpath) + print srcpath + Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--preload-file', srcpath, '-o', 'page.html']).communicate() + self.run_browser('page.html', 'You should see |load me right before|.', '/report_result?1') # By absolute path - make_main(os.path.join(self.get_dir(), 'somefile.txt')) - Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--preload-file', os.path.join(self.get_dir(), 'somefile.txt'), '-o', 'page.html']).communicate() + make_main(absolute_src_path) + Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--preload-file', absolute_src_path, '-o', 'page.html']).communicate() self.run_browser('page.html', 'You should see |load me right before|.', '/report_result?1') + # Test subdirectory handling with asset packaging. + os.makedirs(os.path.join(self.get_dir(), 'assets/sub/asset1/').replace('\\', '/')) + os.makedirs(os.path.join(self.get_dir(), 'assets/sub/asset2/').replace('\\', '/')) + open(os.path.join(self.get_dir(), 'assets/sub/asset1/file1.txt'), 'w').write('''load me right before running the code please''') + open(os.path.join(self.get_dir(), 'assets/sub/asset2/file2.txt'), 'w').write('''load me right before running the code please''') + absolute_assets_src_path = os.path.join(self.get_dir(), 'assets').replace('\\', '/') + def make_main_two_files(path1, path2): + open(os.path.join(self.get_dir(), 'main.cpp'), 'w').write(self.with_report_result(r''' + #include <stdio.h> + #include <string.h> + #include <emscripten.h> + int main() { + FILE *f = fopen("%s", "r"); + char buf[100]; + fread(buf, 1, 20, f); + buf[20] = 0; + fclose(f); + printf("|%%s|\n", buf); + + int result = !strcmp("load me right before", buf); + + f = fopen("%s", "r"); + if (f == NULL) + result = 0; + fclose(f); + REPORT_RESULT(); + return 0; + } + ''' % (path1, path2))) + + test_cases = [ + # (source directory to embed, file1 on target FS to load, file2 on target FS to load) + ("assets", "assets/sub/asset1/file1.txt", "assets/sub/asset2/file2.txt"), + ("assets/", "assets/sub/asset1/file1.txt", "assets/sub/asset2/file2.txt"), + ("assets@/", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt"), + ("assets/@/", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt"), + ("assets@./", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt"), + (absolute_assets_src_path + "@/", "/sub/asset1/file1.txt", "/sub/asset2/file2.txt"), + (absolute_assets_src_path + "@/assets", "/assets/sub/asset1/file1.txt", "/assets/sub/asset2/file2.txt")] + + for test in test_cases: + (srcpath, dstpath1, dstpath2) = test + make_main_two_files(dstpath1, dstpath2) + print srcpath + Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--preload-file', srcpath, '-o', 'page.html']).communicate() + self.run_browser('page.html', 'You should see |load me right before|.', '/report_result?1') + # Should still work with -o subdir/.. - make_main(os.path.join(self.get_dir(), 'somefile.txt')) + make_main(absolute_src_path) try: os.mkdir(os.path.join(self.get_dir(), 'dirrey')) except: pass - Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--preload-file', os.path.join(self.get_dir(), 'somefile.txt'), '-o', 'dirrey/page.html']).communicate() + Popen([PYTHON, EMCC, os.path.join(self.get_dir(), 'main.cpp'), '--preload-file', absolute_src_path, '-o', 'dirrey/page.html']).communicate() self.run_browser('dirrey/page.html', 'You should see |load me right before|.', '/report_result?1') # With FS.preloadFile @@ -12092,6 +12487,9 @@ elif 'browser' in str(sys.argv): self.run_browser('something.html', 'You should see animating gears.', '/report_gl_result?true') assert ('var GLEmulation' in open(self.in_dir('something.html')).read()) == emulation, "emulation code should be added when asked for" + def test_fulles2_sdlproc(self): + self.btest('full_es2_sdlproc.c', '1', args=['-s', 'GL_TESTING=1', '-DHAVE_BUILTIN_SINCOS', '-s', 'FULL_ES2=1']) + def test_glgears_deriv(self): self.reftest(path_from_root('tests', 'gears.png')) Popen([PYTHON, EMCC, path_from_root('tests', 'hello_world_gles_deriv.c'), '-o', 'something.html', '-s', 'GL_TESTING=1', @@ -12205,14 +12603,6 @@ elif 'browser' in str(sys.argv): shutil.copyfile(path_from_root('tests', 'screenshot.png'), os.path.join(self.get_dir(), 'screenshot.png')) self.btest('gl_ps_packed.c', reference='gl_ps.png', args=['--preload-file', 'screenshot.png']) - def test_gl_ps_workaround(self): - shutil.copyfile(path_from_root('tests', 'screenshot.png'), os.path.join(self.get_dir(), 'screenshot.png')) - self.btest('gl_ps_workaround.c', reference='gl_ps.png', args=['--preload-file', 'screenshot.png']) - - def test_gl_ps_workaround2(self): - shutil.copyfile(path_from_root('tests', 'screenshot.png'), os.path.join(self.get_dir(), 'screenshot.png')) - self.btest('gl_ps_workaround2.c', reference='gl_ps.png', args=['--preload-file', 'screenshot.png']) - def test_gl_ps_strides(self): shutil.copyfile(path_from_root('tests', 'screenshot.png'), os.path.join(self.get_dir(), 'screenshot.png')) self.btest('gl_ps_strides.c', reference='gl_ps_strides.png', args=['--preload-file', 'screenshot.png']) @@ -13063,6 +13453,11 @@ elif 'benchmark' in str(sys.argv): src = open(path_from_root('tests', 'life.c'), 'r').read() self.do_benchmark('life', src, '''--------------------------------''', shared_args=['-std=c99'], force_c=True) + def test_linpack(self): + def output_parser(output): + return 100.0/float(re.search('Unrolled Double Precision +([\d\.]+) Mflops', output).group(1)) + self.do_benchmark('linpack', open(path_from_root('tests', 'linpack.c')).read(), '''Unrolled Double Precision''', force_c=True, output_parser=output_parser) + def test_zzz_java_nbody(self): # tests xmlvm compiled java, including bitcasts of doubles, i64 math, etc. args = [path_from_root('tests', 'nbody-java', x) for x in os.listdir(path_from_root('tests', 'nbody-java')) if x.endswith('.c')] + \ ['-I' + path_from_root('tests', 'nbody-java')] @@ -13086,7 +13481,7 @@ elif 'benchmark' in str(sys.argv): def test_zzz_lua_scimark(self): def output_parser(output): - return 1.0/float(re.search('\nSciMark +([\d\.]+) ', output).group(1)) + return 100.0/float(re.search('\nSciMark +([\d\.]+) ', output).group(1)) self.lua('scimark', '[small problem sizes]', output_parser=output_parser) @@ -13656,7 +14051,7 @@ if __name__ == '__main__': which = map(lambda mode: mode+'.'+test, test_modes) else: which = [which] - + print >> sys.stderr, ','.join(which) for test in which: print >> sys.stderr, 'will skip "%s"' % test |