Skip to contentSkip to conversation

Add dependency checking

PATCH New Punit Agrawal 2 participants 7 messages Jul 11, 2018 – Jul 16, 2018

lore
Share & tools
lore
#0 lore raw

cover Add dependency checking

Hi,

While investigating failures from nightly runs, I came across some tests that don't explicitly check for dependencies.

Add appropriate check for dependencies so the tests are reported as an issue with the configuration rather than a test failure. These set of patches transitions ~50-60 tests from reporting failures to a configuration issue.

Thanks,
Punit

Punit Agrawal (4):
controllers/cgroup_fj_common.sh: Check for dependencies during setup
quota_remount_test01: Add explicit check for dependencies memcg_lib.sh: Check for killall
controllers/pids.sh: Check for killall

 testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 1 +
 testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 3 +++
 testcases/kernel/controllers/pids/pids.sh                  | 1 +
 testcases/kernel/fs/quota_remount/quota_remount_test01.sh  | 4 ++++
 4 files changed, 9 insertions(+)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/4 controllers/cgroup_fj_common.sh: Check for dependencies during setup

cgroup_fj_common.sh uses 'killall' in cleanup but doesn't check for it during setup. Add killall as an explicit dependency to bail out on systems where it's not available.

---
 testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh | 1 +
 1 file changed, 1 insertion(+)
testcases/kernel/controllers/cgroup_fj/cgroup_fj_common.sh +1 -0
index 907881ca8..e163e5394 100755
@@ -83,6 +83,7 @@ create_subgroup()
 setup()
 {
     tst_require_root
+    tst_check_cmds killall
 
     if [ ! -f /proc/cgroups ]; then
         tst_brkm TCONF "Kernel does not support for control groups"
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/4 quota_remount_test01: Add explicit check for dependencies

In reply to Punit Agrawal

quota_remount_test01 doesn't check for dependencies before execution. Add explicit checks for quotacheck and quotaon and bail out if they are not present.

---
 testcases/kernel/fs/quota_remount/quota_remount_test01.sh | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/fs/quota_remount/quota_remount_test01.sh +4 -0
index 24f41aec1..8fa9ffc9f 100755
@@ -41,6 +41,8 @@ export TCID=quota_remount_test01
 export TST_TOTAL=1
 export TST_COUNT=0
 
+. test.sh
+
 if [ -z $TMPDIR ]
 then
 	TMPDIR=/tmp
@@ -58,6 +60,8 @@ if [ ! -d /proc/sys/fs/quota ]; then
         exit 0
 fi
 
+tst_check_cmds quotacheck quotaon
+
 die()
 {
 	echo >&2 $2
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/4 memcg_lib.sh: Check for killall

In reply to Punit Agrawal
---
 testcases/kernel/controllers/memcg/functional/memcg_lib.sh | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/controllers/memcg/functional/memcg_lib.sh +3 -0
index 7892f78c3..838706e1a 100755
@@ -34,6 +34,9 @@ if [ $? -ne 0 ]; then
 	tst_brkm TBROK "getconf PAGESIZE failed"
 fi
 
+# Check for dependencies
+tst_check_cmds killall
+
 # Post 4.16 kernel updates stat in batch (> 32 pages) every time
 PAGESIZES=$(( $PAGESIZE * 33 ))
 
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/4 controllers/pids.sh: Check for killall

In reply to Punit Agrawal
---
 testcases/kernel/controllers/pids/pids.sh | 1 +
 1 file changed, 1 insertion(+)
testcases/kernel/controllers/pids/pids.sh +1 -0
index c5430eed7..fab33c415 100755
@@ -32,6 +32,7 @@ TST_TESTFUNC=do_test
 TST_POS_ARGS=3
 TST_USAGE=usage
 TST_NEEDS_ROOT=1
+TST_NEEDS_CMDS="killall"
 
 . tst_test.sh
 
Signature · 1 line
2.17.1
#5 lore raw

cover Add dependency checking

In reply to Punit Agrawal

----- Original Message -----

Quoted 5 lines

Hi,

While investigating failures from nightly runs, I came across some tests that don't explicitly check for dependencies.

Quoted 8 lines

Add appropriate check for dependencies so the tests are reported as an issue with the configuration rather than a test failure. These set of patches transitions ~50-60 tests from reporting failures to a configuration issue.

Thanks,
Punit

Hi,

Pushed with the exception of patch 2.

Switching quota_remount_test01.sh away from apicmds will likely need more changes, e.g. it should use at least tst_exit().

If we take the effort to port this test to shell library, it should be "tst_test.h" one.

If you're up to rewriting test for tst_test.h, that would be preffered. Otherwise, I rather use some shell check and avoid including "test.h" for the sole purpose of having tst_check_cmds.

Regards,
Jan

#6 lore raw

cover Add dependency checking

Quoted 11 lines · Jan Stancek

----- Original Message -----

Quoted 10 lines

Hi,

While investigating failures from nightly runs, I came across some tests that don't explicitly check for dependencies.

Add appropriate check for dependencies so the tests are reported as an issue with the configuration rather than a test failure. These set of patches transitions ~50-60 tests from reporting failures to a configuration issue.

Quoted 7 lines
Quoted 3 lines

Thanks,
Punit

Hi,

Pushed with the exception of patch 2.

Thanks for merging the patches.

Quoted 11 lines

Switching quota_remount_test01.sh away from apicmds will likely need more changes, e.g. it should use at least tst_exit().

If we take the effort to port this test to shell library, it should be "tst_test.h" one.

If you're up to rewriting test for tst_test.h, that would be preffered. Otherwise, I rather use some shell check and avoid including "test.h" for the sole purpose of having tst_check_cmds.

Ok, makes sense to use a shell check. I'll send an updated patch.

I won't be able to get to rewriting the test anytime soon but I'd really like to eliminate the false positives on the nightly runs so we can start paying attention to the real failures on new development.

Regards,
Punit