Skip to content

Commit f378edc

Browse files
authored
Add regression tests of BA issue cases (#3462)
1 parent 6fdfedb commit f378edc

149 files changed

Lines changed: 2763 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.zip
2+
build
3+
*.log
4+
**/out.aot
Lines changed: 249 additions & 0 deletions
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright (C) 2019 Intel Corporation. All rights reserved.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
8+
PLATFORM=$(uname -s | tr A-Z a-z)
9+
10+
readonly WORK_DIR=$PWD
11+
readonly WAMR_DIR=${WORK_DIR}/../../..
12+
13+
function build_wamrc() {
14+
echo "Build wamrc for spec test under aot compile type"
15+
cd ${WAMR_DIR}/wamr-compiler &&
16+
./build_llvm.sh &&
17+
cd ${WORK_DIR}/build &&
18+
if [ -d build-wamrc ]; then rm -rf build-wamrc; else mkdir build-wamrc; fi &&
19+
cd build-wamrc && cmake ${WAMR_DIR}/wamr-compiler && make -j 4
20+
}
21+
22+
function build_iwasm() {
23+
echo "Build iwasm with compile flags " $1 " "
24+
cd ${WAMR_DIR}/product-mini/platforms/${PLATFORM} &&
25+
cd ${WORK_DIR}/build &&
26+
if [ -d build-iwasm-$2 ]; then rm -rf build-iwasm-$2; else mkdir build-iwasm-$2; fi &&
27+
cd build-iwasm-$2 &&
28+
cmake ${WAMR_DIR}/product-mini/platforms/${PLATFORM} $1 \
29+
-DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_SANITIZER=asan &&
30+
make -j 4
31+
if [ "$?" != 0 ]; then
32+
echo -e "build iwasm failed"
33+
exit 1
34+
fi
35+
}
36+
37+
rm -fr build && mkdir build
38+
39+
# build wamrc
40+
build_wamrc
41+
42+
# build default iwasm for testing fast-interp and AOT
43+
build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=1" "default"
44+
45+
# build default iwasm for testing fast-interp and AOT with GC enabled
46+
build_iwasm "-DWAMR_BUILD_GC=1 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_SPEC_TEST=1" "default-gc-enabled"
47+
48+
# build llvm-jit iwasm for testing llvm-jit
49+
build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_JIT=1" "llvm-jit"
50+
51+
# build multi-tier-jit iwasm for testing classic-interp, fast-jit, llvm-jit and multi-tier-jit
52+
build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1" "multi-tier-jit"
53+
54+
# build default iwasm for testing fast-interp and AOT with libc-wasi disabled
55+
build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_LIBC_WASI=0" "default-wasi-disabled"
56+
57+
# build llvm-jit iwasm for testing llvm-jit with libc-wasi disabled
58+
build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LIBC_WASI=0" "llvm-jit-wasi-disabled"
59+
60+
# build multi-tier-jit iwasm for testing classic-interp, fast-jit, llvm-jit and multi-tier-jit with libc-wasi disabled
61+
build_iwasm "-DWAMR_BUILD_REF_TYPES=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LIBC_WASI=0" "multi-tier-jit-wasi-disabled"
62+
63+
# TODO: add more version of iwasm, for example, sgx version
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/bin/bash
2+
3+
#
4+
# Copyright (C) 2019 Intel Corporation. All rights reserved.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
8+
# Function to create a directory
9+
create_directory() {
10+
dir_name="issue-$1"
11+
mkdir -p "$dir_name"
12+
echo "Created directory: $dir_name"
13+
14+
# Unzip files if unzip option is enabled
15+
if [ "$unzip" = true ]; then
16+
if [ -d "$dir_name" ]; then
17+
# /opt/wabt/bin/wasm2wat --enable-all $dir_name/PoC.wasm -o $dir_name/PoC.wast
18+
for zipfile in "$dir_name"/*.zip; do
19+
if [ -f "$zipfile" ]; then
20+
echo "Unzipping $zipfile in $dir_name"
21+
unzip -o "$zipfile" -d "$dir_name"
22+
rm $zipfile
23+
# /opt/wabt/bin/wasm2wat --enable-all PoC.wasm -o PoC.wast
24+
fi
25+
done
26+
fi
27+
fi
28+
}
29+
30+
# Initialize unzip option to false
31+
unzip=false
32+
33+
# Parse options
34+
while getopts ":x" opt; do
35+
case $opt in
36+
x)
37+
unzip=true
38+
;;
39+
\?)
40+
echo "Invalid option: -$OPTARG" >&2
41+
exit 1
42+
;;
43+
esac
44+
done
45+
46+
# Remove the parsed options from the arguments
47+
shift $((OPTIND - 1))
48+
49+
# Check if at least one argument is provided
50+
if [ $# -lt 1 ]; then
51+
echo "Usage: $0 [-x] <num1> [num2]"
52+
exit 1
53+
fi
54+
55+
num1=$1
56+
57+
# Changes work directories to issues
58+
cd issues
59+
60+
# If only one argument is provided
61+
if [ $# -eq 1 ]; then
62+
create_directory "$num1"
63+
else
64+
# Extract the second argument
65+
num2=$2
66+
67+
# Check if the second argument is greater than the first
68+
if [ "$num2" -lt "$num1" ]; then
69+
echo "Second number must be greater than or equal to the first number."
70+
exit 1
71+
fi
72+
73+
# Generate directories from num1 to num2
74+
for ((i = num1; i <= num2; i++)); do
75+
create_directory "$i"
76+
done
77+
fi
98 Bytes
Binary file not shown.
98 Bytes
Binary file not shown.
98 Bytes
Binary file not shown.
116 Bytes
Binary file not shown.
98 Bytes
Binary file not shown.
98 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)