Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run_wasi_tests.sh: provide stdin by ourselves #2576

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/wamr-test-suites/wasi-test-script/pipe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /usr/bin/env python3

# Copyright (C) 2023 YAMAMOTO Takashi
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# This is a copy of https://github.com/yamt/toywasm/blob/master/test/pipe.py

# keep stdout open until the peer closes it

import sys
import select

p = select.poll()
p.register(sys.stdout, select.POLLHUP)
# http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=57369
while True:
l = p.poll(1)
if l:
break
7 changes: 5 additions & 2 deletions tests/wamr-test-suites/wasi-test-script/run_wasi_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#

THIS_DIR=$(cd $(dirname $0) && pwd -P)

readonly MODE=$1
readonly TARGET=$2

Expand Down Expand Up @@ -63,7 +65,8 @@ if [[ $MODE != "aot" ]];then
python3 -m venv wasi-env && source wasi-env/bin/activate
python3 -m pip install -r test-runner/requirements.txt

TEST_RUNTIME_EXE="${IWASM_CMD}" python3 test-runner/wasi_test_runner.py \
export TEST_RUNTIME_EXE="${IWASM_CMD}"
python3 ${THIS_DIR}/pipe.py | python3 test-runner/wasi_test_runner.py \
-r adapters/wasm-micro-runtime.py \
-t \
${C_TESTS} \
Expand Down Expand Up @@ -100,4 +103,4 @@ else
done
fi

exit ${exit_code}
exit ${exit_code}