summaryrefslogtreecommitdiff
path: root/auto_update_tests.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-05-03 22:01:14 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-05-03 22:01:14 -0700
commitc7d7083920ddd9ff7d1a44577287b8ecc048a221 (patch)
tree1eb9e0cd2e50566b62f65171ccc35b29f8ca5c4d /auto_update_tests.py
parent5b2adeb4b2a66dfcda7667ce7a4c27ec49c62b1b (diff)
downloadbinaryen-c7d7083920ddd9ff7d1a44577287b8ecc048a221.tar.gz
binaryen-c7d7083920ddd9ff7d1a44577287b8ecc048a221.tar.bz2
binaryen-c7d7083920ddd9ff7d1a44577287b8ecc048a221.zip
Harmonize the internal opcodes with the binary format (#433)
* harmonize the internal opcodes with the binary format, so they clearly parallel, and also this helps us avoid needing the type to disambiguate * comment on GetLocal in C API
Diffstat (limited to 'auto_update_tests.py')
-rwxr-xr-xauto_update_tests.py37
1 files changed, 25 insertions, 12 deletions
diff --git a/auto_update_tests.py b/auto_update_tests.py
index e0ae3a7a7..bd9e5f695 100755
--- a/auto_update_tests.py
+++ b/auto_update_tests.py
@@ -95,17 +95,30 @@ for wast in sorted(os.listdir('test')):
print '\n[ checking example testcases... ]\n'
-cmd = [os.environ.get('CXX') or 'g++', '-std=c++11',
- os.path.join('test', 'example', 'find_div0s.cpp'),
- os.path.join('src', 'pass.cpp'),
- os.path.join('src', 'passes', 'Print.cpp'),
- '-Isrc', '-g', '-lsupport', '-Llib/.']
-if os.environ.get('COMPILER_FLAGS'):
- for f in os.environ.get('COMPILER_FLAGS').split(' '):
- cmd.append(f)
-print ' '.join(cmd)
-subprocess.check_call(cmd)
-actual = subprocess.Popen(['./a.out'], stdout=subprocess.PIPE).communicate()[0]
-open(os.path.join('test', 'example', 'find_div0s.txt'), 'w').write(actual)
+for t in sorted(os.listdir(os.path.join('test', 'example'))):
+ cmd = ['-Isrc', '-g', '-lasmjs', '-lsupport', '-Llib/.', '-pthread']
+ if t.endswith('.cpp'):
+ cmd = [os.path.join('test', 'example', t),
+ os.path.join('src', 'pass.cpp'),
+ os.path.join('src', 'wasm.cpp'),
+ os.path.join('src', 'passes', 'Print.cpp')] + cmd
+ elif t.endswith('.c'):
+ # build the C file separately
+ extra = [os.environ.get('CC') or 'gcc',
+ os.path.join('test', 'example', t), '-c', '-o', 'example.o',
+ '-Isrc', '-g', '-lasmjs', '-lsupport', '-Llib/.', '-pthread']
+ print ' '.join(extra)
+ subprocess.check_call(extra)
+ cmd = ['example.o', '-lbinaryen-c'] + cmd
+ else:
+ continue
+ if os.environ.get('COMPILER_FLAGS'):
+ for f in os.environ.get('COMPILER_FLAGS').split(' '):
+ cmd.append(f)
+ cmd = [os.environ.get('CXX') or 'g++', '-std=c++11'] + cmd
+ print ' '.join(cmd)
+ subprocess.check_call(cmd)
+ actual = subprocess.Popen(['./a.out'], stdout=subprocess.PIPE).communicate()[0]
+ open(os.path.join('test', 'example', '.'.join(t.split('.')[:-1]) + '.txt'), 'w').write(actual)
print '\n[ success! ]'