forked from arceos-org/starry-next
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Azure-stars/test_ci
Run batch tasks and add test CI
- Loading branch information
Showing
74 changed files
with
273 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
AX_ROOT ?= $(PWD)/.arceos | ||
AX_TESTCASE ?= nimbos | ||
ARCH ?= x86_64 | ||
|
||
export AX_TESTCASES_LIST=$(shell cat ./apps/$(AX_TESTCASE)/testcase_list | tr '\n' ',') | ||
|
||
all: build | ||
|
||
ax_root: | ||
@./scripts/set_ax_root.sh $(AX_ROOT) | ||
|
||
user_apps: | ||
@cd ./apps && make ARCH=$(ARCH) build | ||
@make -C ./apps/$(AX_TESTCASE) ARCH=$(ARCH) build | ||
|
||
test: | ||
@./scripts/app_test.sh | ||
|
||
build run justrun debug disasm clean: ax_root | ||
build run justrun debug disasm: ax_root | ||
@make -C $(AX_ROOT) A=$(PWD) $@ | ||
|
||
clean: ax_root | ||
@make -C $(AX_ROOT) A=$(PWD) clean | ||
@cargo clean | ||
|
||
.PHONY: all ax_root build run justrun debug disasm clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
smp = 1 | ||
build_mode = release | ||
log_level = off | ||
|
||
Hello world from user mode program! | ||
Hello, world! | ||
Hello, I am process 2. | ||
Back in process 2, iteration 0. | ||
Back in process 2, iteration 1. | ||
Back in process 2, iteration 2. | ||
Back in process 2, iteration 3. | ||
Back in process 2, iteration 4. | ||
yield passed! | ||
into sleep test! | ||
simple_sleep passed! |
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
apps/rust/rust-toolchain.toml → apps/nimbos/rust/rust-toolchain.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[toolchain] | ||
profile = "minimal" | ||
# use the nightly version of the last stable toolchain, see <https://forge.rust-lang.org/> | ||
channel = "nightly-2022-11-03" | ||
channel = "nightly-2024-05-02" | ||
components = ["rust-src", "llvm-tools-preview", "rustfmt", "clippy"] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test_one "LOG=off" "expect_off.out" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
hello_world | ||
hello_c | ||
yield | ||
sleep_simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
#!/bin/bash | ||
|
||
TIMEOUT=60s | ||
EXIT_STATUS=0 | ||
ROOT=$(realpath $(dirname $0))/../ | ||
|
||
S_PASS=0 | ||
S_FAILED=1 | ||
S_TIMEOUT=2 | ||
S_BUILD_FAILED=3 | ||
|
||
RED_C="\x1b[31;1m" | ||
GREEN_C="\x1b[32;1m" | ||
YELLOW_C="\x1b[33;1m" | ||
CYAN_C="\x1b[36;1m" | ||
BLOD_C="\x1b[1m" | ||
END_C="\x1b[0m" | ||
|
||
if [ -z "$ARCH" ]; then | ||
ARCH=x86_64 | ||
fi | ||
if [ "$ARCH" != "x86_64" ] && [ "$ARCH" != "riscv64" ] && [ "$ARCH" != "aarch64" ]; then | ||
echo "Unknown architecture: $ARCH" | ||
exit $S_FAILED | ||
fi | ||
|
||
|
||
function compare() { | ||
local actual=$1 | ||
local expect=$2 | ||
if [ ! -f "$expect" ]; then | ||
MSG="expected output file \"${BLOD_C}$expect${END_C}\" not found!" | ||
return $S_FAILED | ||
fi | ||
IFS='' | ||
while read -r line; do | ||
local matched=$(grep -m1 -a "$line" < "$actual") | ||
if [ -z "$matched" ]; then | ||
MSG="pattern \"${BLOD_C}$line${END_C}\" not matched!" | ||
unset IFS | ||
return $S_FAILED | ||
fi | ||
done < "$expect" | ||
unset IFS | ||
return $S_PASS | ||
} | ||
|
||
function run_and_compare() { | ||
local args=$1 | ||
local expect=$2 | ||
local actual=$3 | ||
|
||
echo -ne " run with \"${BLOD_C}$args${END_C}\": " | ||
|
||
make -C "$ROOT" A="$APP" $args > "$actual" 2>&1 | ||
if [ $? -ne 0 ]; then | ||
return $S_BUILD_FAILED | ||
fi | ||
|
||
TIMEFORMAT='%3Rs' | ||
RUN_TIME=$( { time { timeout --foreground $TIMEOUT make -C "$ROOT" $args justrun > "$actual" 2>&1; }; } 2>&1 ) | ||
local res=$? | ||
if [ $res == 124 ]; then | ||
return $S_TIMEOUT | ||
elif [ $res -ne 0 ]; then | ||
return $S_FAILED | ||
fi | ||
|
||
compare "$actual" "$expect" | ||
if [ $? -ne 0 ]; then | ||
return $S_FAILED | ||
else | ||
return $S_PASS | ||
fi | ||
} | ||
|
||
|
||
function test_one() { | ||
local args=$1 | ||
local expect="$APP/$2" | ||
local actual="$APP/actual.out" | ||
args="$args ARCH=$ARCH ACCEL=n" | ||
rm -f "$actual" | ||
|
||
MSG= | ||
run_and_compare "$args" "$expect" "$actual" | ||
local res=$? | ||
|
||
if [ $res -ne $S_PASS ]; then | ||
EXIT_STATUS=$res | ||
if [ $res == $S_FAILED ]; then | ||
echo -e "${RED_C}failed!${END_C} $RUN_TIME" | ||
elif [ $res == $S_TIMEOUT ]; then | ||
echo -e "${YELLOW_C}timeout!${END_C} $RUN_TIME" | ||
elif [ $res == $S_BUILD_FAILED ]; then | ||
echo -e "${RED_C}build failed!${END_C}" | ||
fi | ||
if [ ! -z "$MSG" ]; then | ||
echo -e " $MSG" | ||
fi | ||
echo -e "${RED_C}actual output${END_C}:" | ||
cat "$actual" | ||
else | ||
echo -e "${GREEN_C}passed!${END_C} $RUN_TIME" | ||
rm -f "$actual" | ||
fi | ||
} | ||
|
||
# TODO: add more testcases | ||
test_list=( | ||
"nimbos" | ||
) | ||
|
||
for t in ${test_list[@]}; do | ||
APP=$(realpath "$(pwd)/apps/$t") | ||
make -C "$ROOT" user_apps AX_TESTCASE=$t | ||
echo -e "${CYAN_C}Testing${END_C} $t:" | ||
source "$APP/test_cmd" | ||
done | ||
|
||
echo -e "test script exited with: $EXIT_STATUS" | ||
exit $EXIT_STATUS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.