Skip to contentSkip to conversation

controllers/cpuacct: add kernel version check

PATCH New Xiao Yang 2 participants 5 messages Nov 19, 2015 – Nov 24, 2015

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 controllers/cpuacct: add kernel version check

Cpuacct should be supported with kernel 2.6.30 or newer

---
 testcases/kernel/controllers/cpuacct/cpuacct.sh | 5 +++++
 1 file changed, 5 insertions(+)
testcases/kernel/controllers/cpuacct/cpuacct.sh +5 -0
index 8552b5e..9916367 100755
@@ -48,6 +48,11 @@ setup()
 {
 	tst_require_root
 
+	tst_kvercmp 2 6 30
+	if [ $? -eq 0 ]; then
+		tst_brkm TCONF "Test should be run with kernel 2.6.30 or newer"
+	fi
+
 	mount_point=`grep -w cpuacct /proc/mounts | cut -f 2 | cut -d " " -f2`
 	tst_resm TINFO "cpuacct: $mount_point"
 	if [ "$mount_point" = "" ]; then
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 controllers/cpuacct: add kernel version check

Hi!

testcases/kernel/controllers/cpuacct/cpuacct.sh setup() · line 54

Quoted 6 lines
testcases/kernel/controllers/cpuacct/cpuacct.sh +4 -0
 	tst_require_root
 
+	tst_kvercmp 2 6 30
+	if [ $? -eq 0 ]; then
+		tst_brkm TCONF "Test should be run with kernel 2.6.30 or newer"
+	fi

Can we do 'grep -q cpuacct /proc/cgroups' to figure out if it's supported instead?

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#2 lore raw

PATCH 1/1 controllers/cpuacct: add kernel version check

Hi !

Quoted 10 lines

Hi!

testcases/kernel/controllers/cpuacct/cpuacct.sh setup() · line 54

Quoted 6 lines

tst_require_root

testcases/kernel/controllers/cpuacct/cpuacct.sh +4 -0
+	tst_kvercmp 2 6 30
+	if [ $? -eq 0 ]; then
+		tst_brkm TCONF "Test should be run with kernel 2.6.30 or newer"
+	fi

Can we do 'grep -q cpuacct /proc/cgroups' to figure out if it's supported instead?

Thanks, I will rewirte it as what you suggested.

author
#3 lore raw

PATCH v2 1/1 controllers/cpuacct: add cpuacct availability check

In reply to Cyril Hrubis
---
 testcases/kernel/controllers/cpuacct/cpuacct.sh | 5 +++++
 1 file changed, 5 insertions(+)
testcases/kernel/controllers/cpuacct/cpuacct.sh +5 -0
index 8552b5e..8639e42 100755
@@ -48,6 +48,11 @@ setup()
 {
 	tst_require_root
 
+	grep -q cpuacct /proc/cgroups 2>/dev/null
+	if [ $? -ne 0 ]; then
+		tst_brkm TCONF "cpuacct not supported on this system"
+	fi
+
 	mount_point=`grep -w cpuacct /proc/mounts | cut -f 2 | cut -d " " -f2`
 	tst_resm TINFO "cpuacct: $mount_point"
 	if [ "$mount_point" = "" ]; then
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH v2 1/1 controllers/cpuacct: add cpuacct availability check

Hi!
Pushed with minor change (to unify the check with rest of the controllers testcases), thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]