From 0024c8bdd28f701d57e49e65d38b28aad0594299 Mon Sep 17 00:00:00 2001
From: Heejin Ahn <aheejin@gmail.com>
Date: Wed, 13 Dec 2023 10:53:50 -0800
Subject: [test] Port tests in test/ to test/lit/basic/ (#6160)

This ports all tests from `test/` to `test/lit/basic/`. The set of
commands and `CHECK` lines used are the same as the ones in #6159. Now
 we use `lit` to test these, this also deletes all `.wast`,
`.wast.from-wast`, `.wast.fromBinary`, and
`.wast.fromBinary.noDebugInfo` files from `test/` and all related test
routines from the python scripts.

All `CHECK` lines are generated by `update_lit_checks.py --all-items`.

This also deletes these three multi-memory tests in `test/lit/`, because
they seem to contain the same code with the ones in `test/`, which have
been ported to `test/lit/basic/` along with other tests.
- `test/lit/multi-memories-atomics64.wast`
- `test/lit/multi-memories-basics.wast`
- `test/lit/multi-memories-simd.wast`

This also adds newlines between `(func`s in case there are none to make
`CHECK` lines easy to view, and removes some extra existing newlines
here and there.
---
 scripts/test/wasm_opt.py | 61 +++---------------------------------------------
 1 file changed, 3 insertions(+), 58 deletions(-)

(limited to 'scripts/test/wasm_opt.py')

diff --git a/scripts/test/wasm_opt.py b/scripts/test/wasm_opt.py
index 9695eadca..ee95029d6 100644
--- a/scripts/test/wasm_opt.py
+++ b/scripts/test/wasm_opt.py
@@ -104,35 +104,15 @@ def test_wasm_opt():
         actual, err = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True).communicate()
         shared.fail_if_not_identical(actual.strip(), open(os.path.join(shared.get_test_dir('print'), wasm + '.minified.txt')).read().strip())
 
-    print('\n[ checking wasm-opt testcases... ]\n')
-
-    for t in shared.get_tests(shared.options.binaryen_test, ['.wast']):
-        print('..', os.path.basename(t))
-        f = t + '.from-wast'
-        cmd = shared.WASM_OPT + [t, '--print', '-all']
-        actual = support.run_command(cmd)
-        actual = actual.replace('printing before:\n', '')
-
-        shared.fail_if_not_identical_to_file(actual, f)
-
-        # FIXME Remove this condition after nullref is implemented in V8
-        if 'reference-types.wast' not in t:
-            shared.binary_format_check(t, wasm_as_args=['-g'])  # test with debuginfo
-            shared.binary_format_check(t, wasm_as_args=[], binary_suffix='.fromBinary.noDebugInfo')  # test without debuginfo
-
-        shared.minify_check(t)
-
-    print('\n[ checking wasm-opt debugInfo read-write... ]\n')
-
 
 def update_wasm_opt_tests():
-    print('\n[ checking wasm-opt -o notation... ]\n')
+    print('\n[ updating wasm-opt -o notation... ]\n')
     wast = os.path.join(shared.options.binaryen_test, 'hello_world.wat')
     cmd = shared.WASM_OPT + [wast, '-o', 'a.wast', '-S']
     support.run_command(cmd)
     open(wast, 'w').write(open('a.wast').read())
 
-    print('\n[ checking wasm-opt parsing & printing... ]\n')
+    print('\n[ updating wasm-opt parsing & printing... ]\n')
     for t in shared.get_tests(shared.get_test_dir('print'), ['.wast']):
         print('..', os.path.basename(t))
         wasm = t.replace('.wast', '')
@@ -148,7 +128,7 @@ def update_wasm_opt_tests():
         with open(wasm + '.minified.txt', 'wb') as o:
             o.write(actual)
 
-    print('\n[ checking wasm-opt passes... ]\n')
+    print('\n[ updating wasm-opt passes... ]\n')
     for t in shared.get_tests(shared.get_test_dir('passes'), ['.wast', '.wasm']):
         print('..', os.path.basename(t))
         # windows has some failures that need to be investigated:
@@ -183,38 +163,3 @@ def update_wasm_opt_tests():
             with open('a.wat') as i:
                 with open(t + '.wat', 'w') as o:
                     o.write(i.read())
-
-    print('\n[ checking wasm-opt testcases... ]\n')
-    for t in shared.get_tests(shared.options.binaryen_test, ['.wast']):
-        print('..', os.path.basename(t))
-        f = t + '.from-wast'
-        cmd = shared.WASM_OPT + [t, '--print', '-all']
-        actual = support.run_command(cmd)
-        actual = actual.replace('printing before:\n', '')
-        open(f, 'w').write(actual)
-
-    print('\n[ checking binary format testcases... ]\n')
-    for wast in shared.get_tests(shared.options.binaryen_test, ['.wast']):
-        for debug_info in [0, 1]:
-            cmd = shared.WASM_AS + [wast, '-o', 'a.wasm', '-all']
-            if debug_info:
-                cmd += ['-g']
-            print(' '.join(cmd))
-            if os.path.exists('a.wasm'):
-                os.unlink('a.wasm')
-            subprocess.check_call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-            assert os.path.exists('a.wasm')
-
-            cmd = shared.WASM_DIS + ['a.wasm', '-o', 'a.wast', '-all']
-            print(' '.join(cmd))
-            if os.path.exists('a.wast'):
-                os.unlink('a.wast')
-            subprocess.check_call(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-            assert os.path.exists('a.wast')
-            actual = open('a.wast').read()
-            binary_file = wast + '.fromBinary'
-            if not debug_info:
-                binary_file += '.noDebugInfo'
-            with open(binary_file, 'w') as o:
-                print('writey', binary_file)
-                o.write(actual)
-- 
cgit v1.2.3