Skip to contentSkip to conversation

numa01.sh: fix error in getting number of CPUs

PATCH In review Simon Xu 2 participants 4 messages Nov 23, 2012

lore
Share & tools
lore

Simon Xu

author
#0 lore raw

PATCH 1/1 numa01.sh: fix error in getting number of CPUs

test04 in numa01.sh is using a wrong method to get the number of CPUs. This results in:

numactl: cpu argument 9 is out of range

awk: cmd. line:1: fatal: cannot open file `/proc/4116/stat' for reading (No such file or directory)
/opt/ltp/testcases/bin/numa01.sh: line 475: [: =: unary operator expected
awk: cmd. line:1: fatal: cannot open file `/proc/4116/stat' for reading (No such file or directory)
/opt/ltp/testcases/bin/numa01.sh: line 481: [: -ne: unary operator expected /opt/ltp/testcases/bin/numa01.sh: line 488: kill: (4116) - No such process
numa04 4 TBROK : Kill on process 4116 fails

Fix it by getting number of CPUs by grepping /proc/cpuinfo.

---
 testcases/kernel/numa/numa01.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/numa/numa01.sh +1 -1
index 3ea7950..8d0808a 100644
@@ -466,7 +466,7 @@ test04()
     run_on_cpu=0
     running_on_cpu=0
 
-    no_of_cpus=$(ls /sys/devices/system/cpu/ | wc -w)
+    no_of_cpus=$(grep "^processor"  /proc/cpuinfo | wc -l)
     # not sure whether cpu's can't be in odd number
     run_on_cpu=$[$[$no_of_cpus+1]/2]
     numactl --physcpubind=$run_on_cpu support_numa $PAUSE & #just waits for sigint
Signature · 13 lines
1.8.0


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 24 lines · Simon Xu

test04 in numa01.sh is using a wrong method to get the number of CPUs. This results in:

numactl: cpu argument 9 is out of range

awk: cmd. line:1: fatal: cannot open file `/proc/4116/stat' for reading (No such file or directory)
/opt/ltp/testcases/bin/numa01.sh: line 475: [: =: unary operator expected
awk: cmd. line:1: fatal: cannot open file `/proc/4116/stat' for reading (No such file or directory)
/opt/ltp/testcases/bin/numa01.sh: line 481: [: -ne: unary operator expected /opt/ltp/testcases/bin/numa01.sh: line 488: kill: (4116) - No such process
numa04 4 TBROK : Kill on process 4116 fails

Fix it by getting number of CPUs by grepping /proc/cpuinfo.

---
 testcases/kernel/numa/numa01.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/numa/numa01.sh +0 -0
index 3ea7950..8d0808a 100644

testcases/kernel/numa/numa01.sh test04() · line 469

Quoted 5 lines
testcases/kernel/numa/numa01.sh +1 -1
@@ -466,7 +466,7 @@ test04()
     run_on_cpu=0
     running_on_cpu=0
 
-    no_of_cpus=$(ls /sys/devices/system/cpu/ | wc -w)
+    no_of_cpus=$(grep "^processor"  /proc/cpuinfo | wc -l)

We have commands tst_ncpus and tst_ncpus_max to get the number of cpu in the system.

Thanks,
Wanlong Gao

testcases/kernel/numa/numa01.sh test04() · line 472

Quoted 4 lines
testcases/kernel/numa/numa01.sh +0 -0
     # not sure whether cpu's can't be in odd number
     run_on_cpu=$[$[$no_of_cpus+1]/2]
     numactl --physcpubind=$run_on_cpu support_numa $PAUSE & #just waits for sigint

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#2 lore raw
Quoted 28 lines · Wanlong Gao
Quoted 27 lines · Simon Xu

test04 in numa01.sh is using a wrong method to get the number of CPUs. This results in:

numactl: cpu argument 9 is out of range

awk: cmd. line:1: fatal: cannot open file `/proc/4116/stat' for reading (No such file or directory)
/opt/ltp/testcases/bin/numa01.sh: line 475: [: =: unary operator expected
awk: cmd. line:1: fatal: cannot open file `/proc/4116/stat' for reading (No such file or directory)
/opt/ltp/testcases/bin/numa01.sh: line 481: [: -ne: unary operator expected /opt/ltp/testcases/bin/numa01.sh: line 488: kill: (4116) - No such process
numa04 4 TBROK : Kill on process 4116 fails

Fix it by getting number of CPUs by grepping /proc/cpuinfo.

---
  testcases/kernel/numa/numa01.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/numa/numa01.sh +0 -0
index 3ea7950..8d0808a 100644
@@ -466,7 +466,7 @@ test04()
      run_on_cpu=0
      running_on_cpu=0
 
Quoted 3 lines

testcases/kernel/numa/numa01.sh test04() · line 469

Quoted 2 lines
testcases/kernel/numa/numa01.sh +1 -1
-    no_of_cpus=$(ls /sys/devices/system/cpu/ | wc -w)
+    no_of_cpus=$(grep "^processor"  /proc/cpuinfo | wc -l)

We have commands tst_ncpus and tst_ncpus_max to get the number of cpu in the system.

That's fine. Please fix this issue the LTP way.

Thanks
Simon

Quoted 3 lines

testcases/kernel/numa/numa01.sh test04() · line 472

Quoted 3 lines
testcases/kernel/numa/numa01.sh +0 -0
      # not sure whether cpu's can't be in odd number
      run_on_cpu=$[$[$no_of_cpus+1]/2]
      numactl --physcpubind=$run_on_cpu support_numa $PAUSE & #just waits for sigint

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 32 lines · Simon Xu
Quoted 20 lines · Wanlong Gao
Quoted 19 lines · Simon Xu

test04 in numa01.sh is using a wrong method to get the number of CPUs. This results in:

numactl: cpu argument 9 is out of range

awk: cmd. line:1: fatal: cannot open file `/proc/4116/stat' for reading (No such file or directory)
/opt/ltp/testcases/bin/numa01.sh: line 475: [: =: unary operator expected
awk: cmd. line:1: fatal: cannot open file `/proc/4116/stat' for reading (No such file or directory)
/opt/ltp/testcases/bin/numa01.sh: line 481: [: -ne: unary operator expected /opt/ltp/testcases/bin/numa01.sh: line 488: kill: (4116) - No such process
numa04 4 TBROK : Kill on process 4116 fails

Fix it by getting number of CPUs by grepping /proc/cpuinfo.

---
  testcases/kernel/numa/numa01.sh | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 10 lines

testcases/kernel/numa/numa01.sh test04() · line 469

Quoted 9 lines
testcases/kernel/numa/numa01.sh +1 -0
index 3ea7950..8d0808a 100644
@@ -466,7 +466,7 @@ test04()
      run_on_cpu=0
      running_on_cpu=0
  -    no_of_cpus=$(ls /sys/devices/system/cpu/ | wc -w)
+    no_of_cpus=$(grep "^processor"  /proc/cpuinfo | wc -l)

We have commands tst_ncpus and tst_ncpus_max to get the number of cpu in the system.

Quoted 1 line

That's fine. Please fix this issue the LTP way.

Thank you, I made a patch to fix this, please refer to: https://github.com/linux-test-project/ltp/commit/9b87d9c5678ad3dc2cf561774c7a1c6a16388935

Wanlong Gao

Quoted 8 lines

Thanks
Simon

Quoted 3 lines
Quoted 3 lines
testcases/kernel/numa/numa01.sh +0 -0
      # not sure whether cpu's can't be in odd number
      run_on_cpu=$[$[$no_of_cpus+1]/2]
      numactl --physcpubind=$run_on_cpu support_numa $PAUSE & #just waits for sigint

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list