From 1349f6244398ee4dd2c489a6d7e5a1e6a2dfc51c Mon Sep 17 00:00:00 2001 From: Xsolars Date: Tue, 4 Jun 2024 16:11:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=A0=B9?= =?UTF-8?q?=E7=9B=AE=E5=BD=95Makefile=20clean=E7=9B=AE=E5=BD=95=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fb61044..9dfeea4 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ generate_json_report: clean: for dir in $(EXERCISES); do \ - $(MAKE) -C $$dir clean; \ + $(MAKE) -C $(SRC_DIR)/$$dir clean; \ done rm -rf $(BUILD_DIR) $(RESULT_DIR) -- Gitee From 036f8e021ee1975aa0ef6a5516f91cf484ff698c Mon Sep 17 00:00:00 2001 From: Xsolars Date: Tue, 4 Jun 2024 18:46:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E4=BC=98?= =?UTF-8?q?=E5=8C=96rmmod=E5=A4=B1=E8=B4=A5=E4=B8=8D=E6=96=B9=E4=BE=BF?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E9=87=8D=E5=A4=8D=E6=B5=8B=E8=AF=95=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/exercise-30/test.sh | 4 +++- test/exercise-31/test.sh | 4 +++- test/exercise-32/test.sh | 4 +++- test/exercise-33/test.sh | 4 +++- test/exercise-34/test.sh | 4 +++- test/exercise-35/test.sh | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/test/exercise-30/test.sh b/test/exercise-30/test.sh index 7d7931a..db2397a 100755 --- a/test/exercise-30/test.sh +++ b/test/exercise-30/test.sh @@ -2,11 +2,13 @@ EXECUTABLE=$1 +KO=$(readelf -s ${EXECUTABLE} | grep FILE | sed '1d' | awk '{print $8}') + insmod $EXECUTABLE MODULE_MESSAGE=$(dmesg | grep "hello world!") -rmmod $EXECUTABLE || true # 卸载模块有概率会失败,不过我们只需要运行一次。由于 EXECUTABLE 脱离了产物构造路径造成。 +rmmod ${KO%.c} if [ ! -z "$MODULE_MESSAGE" ]; then echo "Test passed." diff --git a/test/exercise-31/test.sh b/test/exercise-31/test.sh index c6341a8..5b5ab25 100755 --- a/test/exercise-31/test.sh +++ b/test/exercise-31/test.sh @@ -2,11 +2,13 @@ EXECUTABLE=$1 +KO=$(readelf -s ${EXECUTABLE} | grep FILE | sed '1d' | awk '{print $8}') + insmod $EXECUTABLE factorial_input=5 MODULE_MESSAGE=$(dmesg | grep "Factorial of 5 is 120") -rmmod $EXECUTABLE || true # 卸载模块有概率会失败,不过我们只需要运行一次。由于 EXECUTABLE 脱离了产物构造路径造成。 +rmmod ${KO%.c} if [ ! -z "$MODULE_MESSAGE" ]; then echo "Test passed." diff --git a/test/exercise-32/test.sh b/test/exercise-32/test.sh index 109879c..2ba48d4 100755 --- a/test/exercise-32/test.sh +++ b/test/exercise-32/test.sh @@ -2,11 +2,13 @@ EXECUTABLE=$1 +KO=$(readelf -s ${EXECUTABLE} | grep FILE | sed '1d' | awk '{print $8}') + insmod $EXECUTABLE reverse_string_input="hello,world" MODULE_MESSAGE=$(dmesg | grep "Reversed string: dlrow,olleh") -rmmod $EXECUTABLE || true # 卸载模块有概率会失败,不过我们只需要运行一次。由于 EXECUTABLE 脱离了产物构造路径造成。 +rmmod ${KO%.c} if [ ! -z "$MODULE_MESSAGE" ]; then echo "Test passed." diff --git a/test/exercise-33/test.sh b/test/exercise-33/test.sh index 2f291fe..6fbd257 100755 --- a/test/exercise-33/test.sh +++ b/test/exercise-33/test.sh @@ -2,11 +2,13 @@ EXECUTABLE=$1 +KO=$(readelf -s ${EXECUTABLE} | grep FILE | sed '1d' | awk '{print $8}') + insmod $EXECUTABLE average_input=5,10,15,20,25 MODULE_MESSAGE=$(dmesg | grep "Average of the array: 15") -rmmod $EXECUTABLE || true # 卸载模块有概率会失败,不过我们只需要运行一次。由于 EXECUTABLE 脱离了产物构造路径造成。 +rmmod ${KO%.c} if [ ! -z "$MODULE_MESSAGE" ]; then echo "Test passed." diff --git a/test/exercise-34/test.sh b/test/exercise-34/test.sh index 7d05e58..009e876 100755 --- a/test/exercise-34/test.sh +++ b/test/exercise-34/test.sh @@ -2,11 +2,13 @@ EXECUTABLE=$1 +KO=$(readelf -s ${EXECUTABLE} | grep FILE | sed '1d' | awk '{print $8}') + insmod $EXECUTABLE ls_array_input=3,6,9,12,15 ls_target=12 MODULE_MESSAGE=$(dmesg | grep "Index of 12 in the array: 3") -rmmod $EXECUTABLE || true # 卸载模块有概率会失败,不过我们只需要运行一次。由于 EXECUTABLE 脱离了产物构造路径造成。 +rmmod ${KO%.c} if [ ! -z "$MODULE_MESSAGE" ]; then echo "Test passed." diff --git a/test/exercise-35/test.sh b/test/exercise-35/test.sh index e3d715d..c9f23f3 100755 --- a/test/exercise-35/test.sh +++ b/test/exercise-35/test.sh @@ -2,6 +2,8 @@ EXECUTABLE=$1 +KO=$(readelf -s ${EXECUTABLE} | grep FILE | sed '1d' | awk '{print $8}') + MODULE_MESSAGE_1=$(dmesg | grep "Delay 2s!") insmod $EXECUTABLE @@ -10,7 +12,7 @@ sleep 3 MODULE_MESSAGE_2=$(dmesg | grep "Delay 2s!") -rmmod $EXECUTABLE || true # 卸载模块有概率会失败,不过我们只需要运行一次。由于 EXECUTABLE 脱离了产物构造路径造成。 +rmmod ${KO%.c} if [ -n "$MODULE_MESSAGE_2" ] && [ -z "$MODULE_MESSAGE_1" ]; then echo "Test passed." -- Gitee