From 19911e0eb9770c75091736182dadfa5b9bd68f1a Mon Sep 17 00:00:00 2001 From: YunYou Date: Fri, 16 May 2025 15:54:18 +0800 Subject: [PATCH 1/3] fix oe_test_check_file_sys_protect_001 testcase optimize oe_test_basic_cmd_chmod testcase --- .../oe_test_basic_cmd_chmod.sh | 14 +++++++------- .../oe_test_check_file_sys_protect_001.sh | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/testcases/embedded-test/os_basic_tests/oe_test_basic_cmd_chmod/oe_test_basic_cmd_chmod.sh b/testcases/embedded-test/os_basic_tests/oe_test_basic_cmd_chmod/oe_test_basic_cmd_chmod.sh index 20519e5f7..c5519bdda 100644 --- a/testcases/embedded-test/os_basic_tests/oe_test_basic_cmd_chmod/oe_test_basic_cmd_chmod.sh +++ b/testcases/embedded-test/os_basic_tests/oe_test_basic_cmd_chmod/oe_test_basic_cmd_chmod.sh @@ -36,14 +36,14 @@ function run_test() { LOG_INFO "Start to run test." output1=$(ls -l /tmp) - echo "$output1" | grep "test01" | awk '{print $1}' | grep "drwxrwxrwx" + echo "$output1" | grep "test01" | awk '{print $1}' | grep -e "drwxrwxrwx" CHECK_RESULT $? 1 0 "dir default mod is drwxrwxrwx" output2=$(ls -l /tmp/test01) per01=$(echo "$output2" | grep "test02" | awk '{print $1}') chmod 777 /tmp/test01 output3=$(ls -l /tmp) - echo "$output3" | grep "test01" | awk '{print $1}' | grep "drwxrwxrwx" + echo "$output3" | grep "test01" | awk '{print $1}' | grep -e "drwxrwxrwx" CHECK_RESULT $? 0 0 "after chmod check /tmp/test01 mod fail" output4=$(ls -l /tmp/test01) per02=$(echo "$output4" | grep "test02" | awk '{print $1}') @@ -52,23 +52,23 @@ function run_test() { chmod -R 777 /tmp/test01 output5=$(ls -l /tmp) - echo "$output5" | grep "test01" | awk '{print $1}' | grep "drwxrwxrwx" + echo "$output5" | grep "test01" | awk '{print $1}' | grep -e "drwxrwxrwx" CHECK_RESULT $? 0 0 "check chmod -R change test01 mod fail" output6=$(ls -l /tmp/test01) - echo "$output6" | grep "test02" | awk '{print $1}' | grep "drwxrwxrwx" + echo "$output6" | grep "test02" | awk '{print $1}' | grep -e "drwxrwxrwx" CHECK_RESULT $? 0 0 "check chmod -R change test02 mod fail" chmod +x /tmp/test02/test03/test03.txt output7=$(ls -l /tmp/test02/test03) - echo "$output7" | grep "test03.txt" | awk '{print $1}' | grep "rwxr-xr-x" + echo "$output7" | grep "test03.txt" | awk '{print $1}' | grep -e "rwxr-xr-x" CHECK_RESULT $? 0 0 "The access of /tmp/test02/test03/test03.txt is error." chmod u-x /tmp/test02/test03/test03.txt output8=$(ls -l /tmp/test02/test03) - echo "$output8" | grep "test03.txt" | awk '{print $1}' | grep "rw-r-xr-x" + echo "$output8" | grep "test03.txt" | awk '{print $1}' | grep -e "rw-r-xr-x" CHECK_RESULT $? 0 0 "The access of /tmp/test02/test03/test03.txt is error." chmod o-w /tmp/test02/test03/test03.txt output9=$(ls -l /tmp/test02/test03) - echo "$output9" | grep "test03.txt" | awk '{print $1}' | grep "rw-r-xr-x" + echo "$output9" | grep "test03.txt" | awk '{print $1}' | grep -e "rw-r-xr-x" CHECK_RESULT $? 0 0 "The access of /tmp/test02/test03/test03.txt is error." chmod --help 2>&1 | grep "Usage" diff --git a/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh b/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh index 1cf0d686d..765fd9287 100644 --- a/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh +++ b/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh @@ -58,7 +58,7 @@ function run_test() { su - tester1 -c "echo $LD_LIBRARY_PATH | grep '[^\n]'" CHECK_RESULT $? 0 1 "check tester1 LD_LIBRARY_PATH value fail" - echo $PATH | grep -E "\.|\.\.|/tmp" + echo $PATH | tr ':' '\n' | grep -w -E "\.|\.\.|/tmp" CHECK_RESULT $? 0 1 "check PATH value fail" LOG_INFO "Finish testcase execution." -- Gitee From 511ff17502a0fee83174bc836fc959f60d3ffa00 Mon Sep 17 00:00:00 2001 From: YunYou Date: Mon, 19 May 2025 09:15:48 +0800 Subject: [PATCH 2/3] Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. On branch master Your branch is up to date with 'origin/master'. Changes to be committed: modified: testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh --- .../oe_test_check_file_sys_protect_001.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh b/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh index 765fd9287..7453b60c9 100644 --- a/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh +++ b/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh @@ -58,7 +58,7 @@ function run_test() { su - tester1 -c "echo $LD_LIBRARY_PATH | grep '[^\n]'" CHECK_RESULT $? 0 1 "check tester1 LD_LIBRARY_PATH value fail" - echo $PATH | tr ':' '\n' | grep -w -E "\.|\.\.|/tmp" + echo "$PATH" | tr ':' '\n' | grep -w -E "\.|\.\.|/tmp" CHECK_RESULT $? 0 1 "check PATH value fail" LOG_INFO "Finish testcase execution." -- Gitee From d929d64670d9d9915a3e7497d7c5604a77c4568a Mon Sep 17 00:00:00 2001 From: YunYou Date: Mon, 19 May 2025 09:37:47 +0800 Subject: [PATCH 3/3] Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. On branch master Your branch is up to date with 'origin/master'. Changes to be committed: modified: testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh --- .../oe_test_check_file_sys_protect_001.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh b/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh index 7453b60c9..d7650eab6 100644 --- a/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh +++ b/testcases/embedded-test/security_config_test/oe_test_check_file_sys_protect_001/oe_test_check_file_sys_protect_001.sh @@ -52,7 +52,7 @@ function run_test() { grep "LD_LIBRARY_PATH" /etc/profile CHECK_RESULT $? 0 1 "check LD_LIBRARY_PATH set in /etc/profile fail" - echo $LD_LIBRARY_PATH | grep '[^\n]' + echo "$LD_LIBRARY_PATH" | grep '[^\n]' CHECK_RESULT $? 0 1 "check root LD_LIBRARY_PATH value fail" su - tester1 -c "echo $LD_LIBRARY_PATH | grep '[^\n]'" -- Gitee