ltp/numa: cleanup work for numa/*
PATCH 2/3 ltp/numa: cleanup work for numa/*
* Remove useless test.sh
* Remove outdated numa_node_size.c
Note: abandoned in commit 67045d7530
* Rewrite support_numa.c
Note: No need to include test.h to get ltp standard PASS/FAIL as ordinary testcases, it's just an aided process which calling in numa.sh)
* Update README document
--- testcases/kernel/numa/.gitignore | 1 - testcases/kernel/numa/README | 25 +--------- testcases/kernel/numa/numa_node_size.c | 88 ---------------------------------- testcases/kernel/numa/support_numa.c | 58 +++++++++------------- testcases/kernel/numa/test.sh | 57 ---------------------- 5 files changed, 25 insertions(+), 204 deletions(-) delete mode 100644 testcases/kernel/numa/numa_node_size.c delete mode 100644 testcases/kernel/numa/test.sh
testcases/kernel/numa/.gitignore +0 -1
@@ -1,2 +1 @@ -/numa_node_size /support_numa
testcases/kernel/numa/README +2 -23
@@ -12,7 +12,7 @@ to either decrease the memory latencies or increase the memory bandwidth by prop Please refer http://lse.sourceforge.net/numa/ to know the basics of numa and refer http://www.novell.com/collateral/4621437/4621437.pdf to understand the usage of numactl and numa libraries. -We can always get the latest package from ftp://ftp.suse.com/pub/people/ak/numa. +We can always get the latest package from http://oss.sgi.com/projects/libnuma/. Testcase Description: ====================================================================================================================
@@ -44,25 +44,4 @@ the policy applied. Pre-requisites ==================================================================================================================== * libnuma should be installed on the NUMA machine before executing theses testcases - * Testcases can also be executed on non-numa machines, but they will fail, - -Building the Tescases -==================================================================================================================== -From LTP-Root, use <make> to build the testcases -ltp-full-20070731]$ make -or, from -ltp-full-20070731_numa/testcases/kernel/numa]# make - -Installing the Testcases -==================================================================================================================== -From LTP-Root, use <make> to install the testcases -ltp-full-20070731]$ make install -or, from -ltp-full-20070731_numa/testcases/kernel/numa]# make install - -Running the Tescases -==================================================================================================================== -From LTP-Root, invoke ./runltp -ltp-full-20070731]$ ./runltp -p -l <logfile> -f numa - - * NUMA testcases will not run by default in LTP-runall + * Testcases will not run by default in LTP-runall, they also skip on non-numa machines
testcases/kernel/numa/numa_node_size.c deleted +0 -88
88 lines not on this page · raw message
testcases/kernel/numa/support_numa.c +23 -35
130 lines not on this page · raw message
testcases/kernel/numa/test.sh deleted +0 -57
57 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 2/3 ltp/numa: cleanup work for numa/*
Hi!
Quoted 76 lines
testcases/kernel/numa/support_numa.c +9
-22@@ -1,34 +1,31 @@/******************************************************************************/ /* */ /* Copyright (c) International Business Machines Corp., 2007 */ +/* Copyright (c) Linux Test Project, 2016 */ /* */ -/* This program is free software; you can redistribute it and/or modify */ +/* This program is free software: you can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ -/* the Free Software Foundation; either version 2 of the License, or */ +/* the Free Software Foundation, either version 3 of the License, or */ /* (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ -/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ -/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ -/* the GNU General Public License for more details. */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ -/* along with this program; if not, write to the Free Software */ -/* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* */ /******************************************************************************/ /******************************************************************************/ /* */ -/* File: support_numa.c */ +/* File: support_numa.c */ /* */ /* Description: Allocates 1MB of memory and touches it to verify numa */ /* */ /* Author: Sivakumar Chinnaiah [email protected] */ /* */ -/* History: Created - Jul 18 2007 - Sivakumar Chinnaiah */ -/* [email protected] */ -/* */ /******************************************************************************/ #include <stdio.h> @@ -38,24 +35,14 @@#include <signal.h> #include <limits.h> #include <string.h> -#include "test.h" /* Global Variables */ #define MB (1<<20)#define PAGE_SIZE getpagesize()#define barrier () __asm__ __volatile__("": : :"memory") -/* Extern Global Variables */ -extern int tst_count;/* to avoid compilation errors. */ -extern char *TESTDIR ;/* to avoid compilation errors. */ - -/* Global Variables */ -char *TCID ="support_numa" ;/* to avoid compilation errors. */ -int TST_TOTAL =1 ;/* to avoid compilation errors. */ - -void sigfunc (int sig) +void sigfunc (__attribute__ ((unused))int sig) { -tst_resm (TINFO ,"#Caught signal signum=%d" , sig); }/******************************************************************************/ @@ -65,9 +52,9 @@ void sigfunc(int sig)/* Description: Alloctes 1MB of memory and touches it to verify numa behaviour*/ /* */
testcases/kernel/numa/support_numa.c void sigfunc(int sig) · line 60
Quoted 10 lines
testcases/kernel/numa/support_numa.c +3
-3/* Input: Describe input arguments to this program */ -/* argv[1] ==1 then print pagesize */ -/* argv[1] ==2 then allocate 1MB of memory */ -/* argv[1] ==3 then pause the program to catch sigint */ +/* argv[1] == 1 then print pagesize */ +/* argv[1] == 2 then allocate 1MB of memory */ +/* argv[1] == 3 then pause the program to catch sigint */ /* */ /* Exit: On failure - Exits with non-zero value. */ /* On success - exits with 0 exit value. */
It would be much better to remove this whole comment and rather add a help() function that explains the paramters and call it when wrong parameter was encountered in the switch() below.
testcases/kernel/numa/support_numa.c int main(int argc, char *argv[]) · line 71
Quoted 9 lines
testcases/kernel/numa/support_numa.c +2
-1@@ -78,40 +65,41 @@ int main(int argc, char *argv[]) {int i;char *buf =NULL ; -int count =0 ;struct sigaction sa; +if (argc !=2 ) { +printf ("Error: arguments not right.\n" );
^
This is pretty value and hence useless. You should rather explain that the program takes exactly one numeric parameter.
testcases/kernel/numa/support_numa.c int main(int argc, char *argv[]) · line 72
Quoted 1 line
testcases/kernel/numa/support_numa.c +1
-0+exit (-1 );
You should rather exit with 1 here.
testcases/kernel/numa/support_numa.c int main(int argc, char *argv[]) · line 82
Quoted 13 lines
testcases/kernel/numa/support_numa.c +4
-3+ } +switch (atoi (argv[1 ])) {case 1 :printf ("%d" ,PAGE_SIZE ); -tst_exit (); +return 0 ;case 2 : buf =malloc (MB );if (!buf) { -tst_resm (TINFO ,"#Memory is not available\n" ); -tst_exit (); +printf ("Memory is not available\n" );
It would be a bit better to print the error messages into the stderr instead.
Quoted 29 lines
testcases/kernel/numa/support_numa.c +4
-6exit (2 ); }for (i =0 ; i <MB ; i +=PAGE_SIZE ) { - count++; buf[i] ='a' ;barrier (); }free (buf); -tst_exit (); +return 0 ;case 3 :/* Trap SIGINT */ sa.sa_handler = sigfunc; sa.sa_flags =SA_RESTART ;sigemptyset (&sa.sa_mask);if (sigaction (SIGINT , &sa,0 ) <0 ) { -tst_brkm (TBROK ,NULL ,"#Sigaction SIGINT failed\n" ); -tst_exit (); -exit (1 ); +printf ("Sigaction SIGINT failed\n" ); +exit (3 ); }/* wait for signat Int */ pause (); -tst_exit (); +return 0 ;default :exit (1 ); }
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 2/3 ltp/numa: cleanup work for numa/*
Hi!
Quoted 4 lines
testcases/kernel/numa/support_numa.c int main(int argc, char *argv[]) · line 71
Quoted 2 lines
testcases/kernel/numa/support_numa.c +2
-0+if (argc !=2 ) { +printf ("Error: arguments not right.\n" );^
This is pretty value and hence useless. You should
^ vague
Quoted 60 lines
rather explain that the program takes exactly one numeric parameter.
testcases/kernel/numa/support_numa.c int main(int argc, char *argv[]) · line 72
Quoted 1 line
testcases/kernel/numa/support_numa.c +1
-0+exit (-1 );You should rather exit with 1 here.
testcases/kernel/numa/support_numa.c int main(int argc, char *argv[]) · line 82
Quoted 13 lines
testcases/kernel/numa/support_numa.c +4
-3+ } +switch (atoi (argv[1 ])) {case 1 :printf ("%d" ,PAGE_SIZE ); -tst_exit (); +return 0 ;case 2 : buf =malloc (MB );if (!buf) { -tst_resm (TINFO ,"#Memory is not available\n" ); -tst_exit (); +printf ("Memory is not available\n" );It would be a bit better to print the error messages into the stderr instead.
Quoted 29 lines
testcases/kernel/numa/support_numa.c +4
-6exit (2 ); }for (i =0 ; i <MB ; i +=PAGE_SIZE ) { - count++; buf[i] ='a' ;barrier (); }free (buf); -tst_exit (); +return 0 ;case 3 :/* Trap SIGINT */ sa.sa_handler = sigfunc; sa.sa_flags =SA_RESTART ;sigemptyset (&sa.sa_mask);if (sigaction (SIGINT , &sa,0 ) <0 ) { -tst_brkm (TBROK ,NULL ,"#Sigaction SIGINT failed\n" ); -tst_exit (); -exit (1 ); +printf ("Sigaction SIGINT failed\n" ); +exit (3 ); }/* wait for signat Int */ pause (); -tst_exit (); +return 0 ;default :exit (1 ); }Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 2/3 ltp/numa: cleanup work for numa/*
agree all these comments below. thanks!
Quoted 72 lines · Cyril Hrubis
Hi!
Quoted 4 lines
testcases/kernel/numa/support_numa.c int main(int argc, char *argv[]) · line 71
Quoted 2 lines
testcases/kernel/numa/support_numa.c +2
-0+if (argc !=2 ) { +printf ("Error: arguments not right.\n" );^
This is pretty value and hence useless. You should^ vagueQuoted 54 lines
rather explain that the program takes exactly one numeric parameter.
Quoted 1 line
+ exit(-1);
You should rather exit with 1 here.
testcases/kernel/numa/support_numa.c int main(int argc, char *argv[]) · line 82
Quoted 13 lines
testcases/kernel/numa/support_numa.c +4
-3+ } +switch (atoi (argv[1 ])) {case 1 :printf ("%d" ,PAGE_SIZE ); -tst_exit (); +return 0 ;case 2 : buf =malloc (MB );if (!buf) { -tst_resm (TINFO ,"#Memory is not available\n" ); -tst_exit (); +printf ("Memory is not available\n" );It would be a bit better to print the error messages into the stderr instead.
Quoted 19 lines
exit(2); } for (i = 0; i < MB; i += PAGE_SIZE) {testcases/kernel/numa/support_numa.c +1
-5- count++; buf[i] ='a' ;barrier (); }free (buf); -tst_exit (); +return 0 ;case 3 :/* Trap SIGINT */ sa.sa_handler = sigfunc; sa.sa_flags =SA_RESTART ;sigemptyset (&sa.sa_mask);if (sigaction (SIGINT , &sa,0 ) <0 ) { -tst_brkm (TBROK ,NULL ,"#Sigaction SIGINT failed\n" ); -tst_exit (); -exit (1 );testcases/kernel/numa/support_numa.c int main(int argc, char *argv[]) · line 105
Quoted 10 lines
testcases/kernel/numa/support_numa.c +3
-1+printf ("Sigaction SIGINT failed\n" ); +exit (3 ); }/* wait for signat Int */ pause (); -tst_exit (); +return 0 ;default :exit (1 ); }Quoted 6 lines
--
Cyril Hrubis
[email protected]--
Mailing list info: https://lists.linux.it/listinfo/ltp--
Cyril Hrubis
[email protected]
Signature · 3 lines
Regards, Li Wang Email: [email protected]