mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 09:53:24 +00:00
Rename regression to test
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
5eefd600cc
commit
f675552c5a
10
test/apps/scripts/Makefile
Normal file
10
test/apps/scripts/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
SOURCES := $(wildcard *.sh)
|
||||
TARGETS := $(addprefix $(BUILD_DIR)/, $(SOURCES))
|
||||
|
||||
.PHONY: all
|
||||
all: $(TARGETS)
|
||||
|
||||
$(BUILD_DIR)/%.sh: %.sh
|
||||
@cp $< $@
|
7
test/apps/scripts/boot_hello.sh
Normal file
7
test/apps/scripts/boot_hello.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
echo "Successfully booted."
|
62
test/apps/scripts/fs.sh
Executable file
62
test/apps/scripts/fs.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
check_file_size() {
|
||||
local file_name="$1"
|
||||
local expected_size="$2"
|
||||
|
||||
if [ ! -f "$file_name" ]; then
|
||||
echo "Error: File does not exist."
|
||||
return 1
|
||||
fi
|
||||
|
||||
actual_size=$(du -b "$file_name" | cut -f1)
|
||||
|
||||
if [ "$actual_size" -eq "$expected_size" ]; then
|
||||
return 0
|
||||
else
|
||||
echo "Error: File size is incorrect: expected ${expected_size}, but got ${actual_size}."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
test_ext2() {
|
||||
local ext2_dir="$1"
|
||||
local test_file="$2"
|
||||
|
||||
cd ${ext2_dir}
|
||||
|
||||
# Test case for the big file feature
|
||||
for i in $(seq 1 10); do
|
||||
truncate -s 500M ${test_file}
|
||||
check_file_size ${test_file} $((500 * 1024 * 1024))
|
||||
truncate -s 2K ${test_file}
|
||||
check_file_size ${test_file} $((2 * 1024))
|
||||
done
|
||||
|
||||
# Clean up
|
||||
rm -f ${test_file}
|
||||
sync
|
||||
cd -
|
||||
}
|
||||
|
||||
test_fdatasync() {
|
||||
fdatasync/fdatasync /
|
||||
rm -f /test_fdatasync.txt
|
||||
fdatasync/fdatasync /ext2
|
||||
rm -f /ext2/test_fdatasync.txt
|
||||
fdatasync/fdatasync /exfat
|
||||
rm -f /exfat/test_fdatasync.txt
|
||||
}
|
||||
|
||||
echo "Start ext2 fs test......"
|
||||
test_ext2 "/ext2" "test_file.txt"
|
||||
echo "All ext2 fs test passed."
|
||||
|
||||
echo "Start fdatasync test......"
|
||||
test_fdatasync
|
||||
echo "All fdatasync test passed."
|
27
test/apps/scripts/network.sh
Executable file
27
test/apps/scripts/network.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
NETTEST_DIR=/test/network
|
||||
cd ${NETTEST_DIR}
|
||||
|
||||
echo "Start network test......"
|
||||
|
||||
./tcp_server &
|
||||
./tcp_client
|
||||
./udp_server &
|
||||
./udp_client
|
||||
./unix_server &
|
||||
./unix_client
|
||||
./socketpair
|
||||
./sockoption
|
||||
./listen_backlog
|
||||
./send_buf_full
|
||||
./http_server &
|
||||
./http_client
|
||||
./tcp_err
|
||||
./udp_err
|
||||
|
||||
echo "All network test passed"
|
35
test/apps/scripts/process.sh
Executable file
35
test/apps/scripts/process.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR=/test
|
||||
cd ${SCRIPT_DIR}/..
|
||||
|
||||
echo "Start process test......"
|
||||
# These test programs are sorted by name.
|
||||
tests="
|
||||
clone3/clone_process
|
||||
execve/execve
|
||||
eventfd2/eventfd2
|
||||
fork/fork
|
||||
fork_c/fork
|
||||
getpid/getpid
|
||||
hello_pie/hello
|
||||
hello_world/hello_world
|
||||
itimer/setitimer
|
||||
itimer/timer_create
|
||||
mmap/mmap_and_fork
|
||||
pthread/pthread_test
|
||||
pty/open_pty
|
||||
signal_c/parent_death_signal
|
||||
signal_c/signal_test
|
||||
"
|
||||
|
||||
for testcase in ${tests}
|
||||
do
|
||||
echo "Running test ${testcase}......"
|
||||
${SCRIPT_DIR}/${testcase}
|
||||
done
|
||||
echo "All process test passed."
|
16
test/apps/scripts/run_general_test.sh
Executable file
16
test/apps/scripts/run_general_test.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR=/test
|
||||
cd ${SCRIPT_DIR}
|
||||
|
||||
./shell_cmd.sh
|
||||
./fs.sh
|
||||
./process.sh
|
||||
./network.sh
|
||||
./test_epoll_pwait.sh
|
||||
|
||||
echo "All general tests passed."
|
17
test/apps/scripts/run_vsock_test.sh
Normal file
17
test/apps/scripts/run_vsock_test.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
# To successfully run the vsock test, you should
|
||||
# 1. Run vsock server binding port 1234 on the host, before running ./vsock_client
|
||||
# 2. Run vsock client connecting (cid,port)=(3,4321) on the host, after running ./vsock_server
|
||||
|
||||
set -e
|
||||
|
||||
VSOCK_DIR=/test/vsock
|
||||
cd ${VSOCK_DIR}
|
||||
|
||||
echo "Start vsock test......"
|
||||
./vsock_client
|
||||
./vsock_server
|
||||
echo "Vsock test passed."
|
39
test/apps/scripts/shell_cmd.sh
Executable file
39
test/apps/scripts/shell_cmd.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
SCRIPT_DIR=/test
|
||||
cd ${SCRIPT_DIR}
|
||||
|
||||
touch hello.txt
|
||||
mv hello.txt hello_world.txt
|
||||
rm hello_world.txt
|
||||
|
||||
awk '{print $2}' shell_cmd.sh
|
||||
cp shell_cmd.sh shell_cmd_backup.sh
|
||||
cat shell_cmd_backup.sh
|
||||
rm shell_cmd_backup.sh
|
||||
|
||||
ln -s shell_cmd.sh tesk_cmd_soft_link
|
||||
readlink -f tesk_cmd_soft_link
|
||||
tail -n 1 tesk_cmd_soft_link
|
||||
rm tesk_cmd_soft_link
|
||||
|
||||
ln shell_cmd.sh tesk_cmd_hard_link
|
||||
tail -n 1 tesk_cmd_hard_link
|
||||
unlink tesk_cmd_hard_link
|
||||
|
||||
sed 3q shell_cmd.sh
|
||||
|
||||
find . -name "*shell_cmd*"
|
||||
|
||||
mkdir foo
|
||||
rmdir foo
|
||||
|
||||
echo "Hello world from asterinas" > hello.txt
|
||||
rm hello.txt
|
||||
|
||||
cd ..
|
31
test/apps/scripts/test_epoll_pwait.sh
Executable file
31
test/apps/scripts/test_epoll_pwait.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
EPOLLTEST_DIR=/test/epoll
|
||||
cd ${EPOLLTEST_DIR}
|
||||
|
||||
echo "Start epoll_pwait test......"
|
||||
|
||||
# Step 2: Run epoll_pwait in the background
|
||||
./epoll_pwait &
|
||||
EPOLL_PID=$!
|
||||
|
||||
echo "epoll_pwait PID: $EPOLL_PID"
|
||||
|
||||
# Step 3: Wait for 1 seconds to let epoll_pwait initialize and block SIGUSR1
|
||||
sleep 1
|
||||
|
||||
# Step 4: Send SIGUSR1 to epoll_pwait
|
||||
kill -USR1 $EPOLL_PID
|
||||
echo "Sent SIGUSR1 to PID $EPOLL_PID"
|
||||
|
||||
# Optional: Wait a bit more to see the output if the process is still running
|
||||
sleep 3
|
||||
|
||||
# You can also wait till the subprocess epoll_pwait completely finishes
|
||||
# wait $EPOLL_PID
|
||||
|
||||
echo "Test completed."
|
4
test/apps/scripts/vsock_commands.sh
Normal file
4
test/apps/scripts/vsock_commands.sh
Normal file
@ -0,0 +1,4 @@
|
||||
# SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
echo 'Line 1: Hello from host'
|
||||
echo 'Line 2: Hello from host, again'
|
Reference in New Issue
Block a user