@@ -1798,10 +1798,16 @@ def ensure(self):
17981798#
17991799# Note it may be better to reduce the second one first, so it imports less from
18001800# the first (otherwise, when the second one imports many things, the first will
1801- # fail to remove exports that are used). To reduce the second one, use a reducer
1802- # script that sets BINARYEN_SECOND_WASM with the file being reduced, and keep
1803- # the primary module fixed by providing a wasm file as an argument to this
1804- # script.
1801+ # fail to remove exports that are used). To reduce the second one, set
1802+ #
1803+ # BINARYEN_FIRST_WASM=${saved_first}
1804+ #
1805+ # The reduce.sh script will then do the right thing, using that as the first
1806+ # wasm, and reducing on the second one, if you replace "original.wasm" in the
1807+ # command with "second.wasm" as needed.
1808+ #
1809+ # In both cases, make sure to copy the files to a saved location first (do not
1810+ # use a path to the scratch files that get constantly overwritten).
18051811class Two (TestCaseHandler ):
18061812 # Run at relatively high priority, as this is the main place we check cross-
18071813 # module interactions.
@@ -2605,9 +2611,18 @@ def get_random_opts():
26052611%(wasm_opt)s %(features)s %(temp_wasm)s
26062612echo " " $?
26072613
2608- # run the command
26092614echo "The following value should be 1:"
2610- ./scripts/fuzz_opt.py %(auto_init)s --binaryen-bin %(bin)s %(seed)d %(temp_wasm)s > o 2> e
2615+
2616+ if [ -z "$BINARYEN_FIRST_WASM" ]; then
2617+ # run the command normally
2618+ ./scripts/fuzz_opt.py %(auto_init)s --binaryen-bin %(bin)s %(seed)d %(temp_wasm)s > o 2> e
2619+ else
2620+ # BINARYEN_FIRST_WASM was provided so we should actually reduce the *second*
2621+ # file. pass the first one in as the main file, and use the env var for the
2622+ # second.
2623+ BINARYEN_SECOND_WASM=%(temp_wasm)s ./scripts/fuzz_opt.py %(auto_init)s --binaryen-bin %(bin)s %(seed)d $BINARYEN_FIRST_WASM > o 2> e
2624+ fi
2625+
26112626echo " " $?
26122627
26132628#
0 commit comments