aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-03-28 15:00:58 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-03-28 15:00:58 -0700
commit054b2403e959ef760f48a8a501477b675bd90221 (patch)
tree1bf244662855f96f04a44e793aa54d11150f6b39 /tests/runner.py
parent85452a0b99426b5caa9cec5aa94730e850776981 (diff)
do not use impure stuff for stdin etc, it makes comparing to native builds harder
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index c806e673..41a2a2dc 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -6674,6 +6674,30 @@ f.close()
output = Popen([NODE_JS, JS_OPTIMIZER, input] + passes, stdin=PIPE, stdout=PIPE).communicate()[0]
self.assertIdentical(expected, output.replace('\n\n', '\n'))
+ def test_llvm_nativizer(self):
+ # avoid impure_ptr problems etc.
+ shutil.copyfile(path_from_root('tests', 'files.cpp'), os.path.join(self.get_dir(), 'files.cpp'))
+ open(os.path.join(self.get_dir(), 'somefile.binary'), 'w').write('''waka waka############################''')
+ open(os.path.join(self.get_dir(), 'test.file'), 'w').write('''ay file..............,,,,,,,,,,,,,,''')
+ open(os.path.join(self.get_dir(), 'stdin'), 'w').write('''inter-active''')
+ Popen(['python', EMCC, os.path.join(self.get_dir(), 'files.cpp'), '-c']).communicate()
+ Popen(['python', path_from_root('tools', 'nativize_llvm.py'), os.path.join(self.get_dir(), 'files.o')]).communicate(input)[0]
+ output = Popen([os.path.join(self.get_dir(), 'files.o.run')], stdin=open(os.path.join(self.get_dir(), 'stdin')), stdout=PIPE, stderr=PIPE).communicate()
+ self.assertIdentical('''size: 37
+data: 119,97,107,97,32,119,97,107,97,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35
+loop: 119 97 107 97 32 119 97 107 97 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
+input:inter-active
+texto
+$
+5 : 10,30,20,11,88
+other=ay file...
+seeked= file.
+seeked=e...
+seeked=,,.
+fscanfed: 10 - hello
+''', output[0])
+ self.assertIdentical('texte\n', output[1])
+
elif 'benchmark' in str(sys.argv):
# Benchmarks. Run them with argument |benchmark|. To run a specific test, do
# |benchmark.test_X|.