diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cases/quoted.ll | 35 | ||||
-rw-r--r-- | tests/runner.py | 17 |
2 files changed, 48 insertions, 4 deletions
diff --git a/tests/cases/quoted.ll b/tests/cases/quoted.ll new file mode 100644 index 00000000..5bd8dba8 --- /dev/null +++ b/tests/cases/quoted.ll @@ -0,0 +1,35 @@ +; 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=2] +define void @"\01_Z5hellov"() { +entry: + %0 = call i32 @puts(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: + %retval = alloca i32 ; [#uses=2] + %0 = alloca i32 ; [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + call void @"\01_Z5hellov"() + store i32 0, i32* %0, align 4 + %1 = load i32* %0, align 4 ; [#uses=1] + store i32 %1, i32* %retval, align 4 + br label %return + +return: ; preds = %entry + %retval1 = load i32* %retval ; [#uses=1] + ret i32 %retval1 +} diff --git a/tests/runner.py b/tests/runner.py index 2a988f8c..d35afa86 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -99,11 +99,10 @@ class RunnerCore(unittest.TestCase): if 'benchmark' not in sys.argv: class T(RunnerCore): # Short name, to make it more fun to use manually on the commandline ## Does a complete test - builds, runs, checks output, etc. - def do_test(self, src, expected_output, args=[], output_nicerizer=None, output_processor=None, no_build=False, main_file=None, js_engines=None, post_build=None): - if not no_build: - print 'Running test:', inspect.stack()[1][3].replace('test_', ''), '[%s%s]' % (COMPILER.split(os.sep)[-1], ',reloop&optimize' if RELOOP else '') + def do_test(self, src, expected_output, args=[], output_nicerizer=None, output_processor=None, no_build=False, main_file=None, js_engines=None, post_build=None, basename='src.cpp'): + print 'Running test:', inspect.stack()[1][3].replace('test_', ''), '[%s%s]' % (COMPILER.split(os.sep)[-1], ',reloop&optimize' if RELOOP else '') dirname = self.get_dir() - filename = os.path.join(dirname, 'src.cpp') + filename = os.path.join(dirname, basename) if not no_build: self.build(src, dirname, filename, main_file=main_file) @@ -1020,6 +1019,16 @@ if 'benchmark' not in sys.argv: no_build=True, js_engines=[V8_ENGINE]) # mozilla bug XXX + ### Test cases in separate files + + def test_cases(self): + for name in os.listdir(path_from_root(['tests', 'cases'])): + shortname = name.replace('.ll', '') + filename = os.path.join(self.get_dir(), shortname) + shutil.copy(path_from_root(['tests', 'cases', name]), filename+'.o.ll') + self.do_emscripten(filename) + self.do_test(None, 'hello, world!', no_build=True, basename=shortname) + ### Integration tests def test_scriptaclass(self): |