1#!/bin/sh
2################################################################################
3##                                                                            ##
4## Copyright (c) International Business Machines  Corp., 2001                 ##
5##                                                                            ##
6## This program is free software;  you can redistribute it and#or modify      ##
7## it under the terms of the GNU General Public License as published by       ##
8## the Free Software Foundation; either version 2 of the License, or          ##
9## (at your option) any later version.                                        ##
10##                                                                            ##
11## This program is distributed in the hope that it will be useful, but        ##
12## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
13## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
14## for more details.                                                          ##
15##                                                                            ##
16## You should have received a copy of the GNU General Public License          ##
17## along with this program;  if not, write to the Free Software               ##
18## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
19##                                                                            ##
20################################################################################
21## File:        runalltests.sh                                                ##
22##                                                                            ##
23## Description:  This script just calls runltp now, and is being phased out.  ##
24##		If you rely on this script for automation reasons, please     ##
25##                                                                            ##
26## History	Subrata Modak <subrata@linuc.vnet.ibm.com> changed the code   ##
27##		to include testing other testcases which are not run by       ##
28##		default, 08/09/2008                                           ##
29##                                                                            ##
30################################################################################
31
32export LTPROOT=${0%/*}
33RUNLTP="$LTPROOT/runltp"
34
35echo  "*******************************************************************"
36echo  "*******************************************************************"
37echo  "**								**"
38echo  "** This script is being re-written to cover all aspects of	**"
39echo  "** testing LTP, which includes running all those tests which	**"
40echo  "** are not run by default with ${RUNLTP##*/} script. Special setup	**"
41echo  "** in system environment will be done to run all those tests	**"
42echo  "** like the File System tests, SELinuxtest, etc			**"
43echo  "**								**"
44echo  "*******************************************************************"
45echo  "*******************************************************************"
46
47export RUN_BALLISTA=0
48export RUN_OPENPOSIX=0
49## Set this to 1 if mm-1.4.2.tar.gz is already installed in your system
50## from ftp://ftp.ossp.org/pkg/lib/mm/mm-1.4.2.tar.gz
51export RUN_MM_CORE_APIS=0
52export LIBMM_INSTALLED=0
53## This is required if already not set to /usr/local/lib/ as
54## mm-1.4.2.tar.gz gets installed at /usr/local/lib/
55export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/:/lib/
56export PATH=$PATH:/sbin/
57
58## Set this to 1 if libaio-0.3.92.tar.gz is already installed in your system
59## from http://www.kernel.org/pub/linux/kernel/people/bcrl/aio/libaio-0.3.92.tar.gz
60export RUN_AIOTESTS=0
61export LIBAIO_INSTALLED=0
62
63## Set this to 1 if libcaps-2.11 or newer is already installed in your system
64## from ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs/libcap2, as well as,
65## the libattr is available in the system. The kernel should also have been built
66## with the following option: CONFIG_SECURITY_FILE_CAPABILITIES=y
67export RUN_FILECAPS=0
68export LIBCAPS_INSTALLED=0
69export LIBATTR_INSTALLED=0
70
71## Set this to 1 if you wish to execute the stress_cd tests
72## Make sure you have FLOPPY inserted, be warned that you
73## will loose all data on it after the tests,
74export RUN_STRESS_FLOPPY=0
75
76## Set this to 1 if you wish to execute the stress_floppy tests
77## Make sure you have CD inserted in your CD-ROM drive,
78export RUN_STRESS_CD=0
79
80##Set this to 1 if you wish to run the CPUHOTPLUG tests
81export RUN_CPU_HOTPLUG=0
82
83##Set this to 1 if you wish to run the LTP-NETWORK tests. Please refer to:
84## http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/testcases/network/LTP-Network-test_README.pdf
85## for more information on how to run the tests.
86export RUN_LTP_NETWORK_TESTS=0
87
88##Set this to 1 if you wish to run the LTP-NETWORK-STRESS tests. Please refer to:
89## http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/testcases/network/LTP-Network-test_README.pdf
90## and http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/testcases/network/stress/README
91## for more information on how to run the NETWORK-STRESS tests.
92export RUN_LTP_NETWORK_STRESS_TESTS=0
93
94## Set this to 1 if you wish to run the ltp/testscripts/adp tests
95export RUN_LTP_ADP_TESTS=0
96
97## Set this to 1 if you wish to run the AUTOFS tests
98#  REQUIREMENTS:
99#   1) System with a floppy device with a floppy disk in it.
100#   2) A spare (scratch) disk partition of 100MB or larger.
101export RUN_LTP_AUTOFS1_TESTS=0
102export RUN_LTP_AUTOFS4_TESTS=0
103export DISK_PARTITION1=0
104
105## Set this to 1 if you wish to run the EXPORTFS tests
106#  DESCRIPTION : A script that will test exportfs on Linux system.
107#  REQUIREMENTS:
108#   1) NFS Server system with rsh enabled between client & server.
109#   2) 100MB Disk partition on NFS server.
110export RUN_EXPORTFS_TESTS=0
111export NFS_SERVER1=xxx
112export NFS_SERVER_DISK_PARTITION1=yyy
113export NFS_SERVER_FS_TYPE1=zzz
114
115
116## Set this to 1 if you wish to run the FS tests on READ ONLY File Systems. Refer to http://ltp.cvs.sourceforge.net/viewvc/ltp/ltp/testscripts/Readme_ROBind for more info
117export RUN_RO_ONLY_FS_TESTS=0
118export READ_ONLY_DIRECTORY1=xxxx
119
120## Set this to 1 if you wish to run the ISOFS tests
121#  REQUIREMENTS:
122#   Must have root access to execute this script
123export RUN_ISOFS_TESTS=0
124
125## Set this to 1 if you wish to run the DMMAPPER tests
126#Note: In order to run this test, you must turn on "device mapper"
127#      component in kernel (it is under device drivers item when you
128#      run make menuconfig); and you must install userspace supporting
129#      files (libdevmapper and dmsetup). They are in the device-mapper
130#      package. You can download it from http://www.sistina.com. Follow
131#      the README/INSTALL file within the package to install it.
132export RUN_DMMAPPER_TESTS=0
133export DISK_PARTITION2=xxxxx
134export DISK_PARTITION3=yyyyy
135
136## Set this to 1 if you wish to run the FSLVM tests
137#Note: fdisk needs to be run and the 4 HD partitions marked as 0x8e -- Linux LVM
138#      - If this is run on a 2.4 kernel system then LVM must be configured and the kernel rebuilt. In a 2.5 environment
139#        you must configure Device Mapper and install LVM2 from www.systina.com for the testcase to run correctly.
140#      - These operations are destructive so do NOT point the tests to partitions where the data shouldn't be overwritten.
141#        Once these tests are started all data in the partitions you point to will be destroyed.
142export RUN_FSLVM_TESTS=0
143export DISK_PARTITION4=xxxxxx
144export DISK_PARTITION5=yyyyyy
145export DISK_PARTITION6=zzzzzz
146export DISK_PARTITION7=iiiiii
147export NFS_PARTITION1=jjjjjj
148
149## Set this to 1 if you wish to run the FSNOLVM tests
150#Note: fdisk needs to be run and the 4 HD partitions marked as 0x8e -- Linux LVM
151#      - If this is run on a 2.4 kernel system then LVM must be configured and the kernel rebuilt. In a 2.5 environment
152#        you must configure Device Mapper and install LVM2 from www.systina.com for the testcase to run correctly.
153#      - These operations are destructive so do NOT point the tests to partitions where the data shouldn't be overwritten.
154#        Once these tests are started all data in the partitions you point to will be destroyed.
155export RUN_FSNOLVM_TESTS=0
156
157## Set this to 1 if you wish to run the LTP SCSI DEBUG tests
158#Note: Build scsi_debug as a module first before running the test
159export RUN_LTP_SCSI_DEBUG_TEST=0
160
161## Set this to 1 if you wish to run the LTP SYSFS tests
162#Note: Must have root access to execute this script.
163#  USAGE       : sysfs.sh [ -k <kernel_module> ]
164#  DESCRIPTION : A script that will test sysfs on Linux system.
165#  REQUIREMENTS: CONFIG_DUMMY must have been used to build kernel, and the
166#                dummy network module must exist.
167export RUN_LTP_SYSFS_TEST=0
168export KERNEL_MODULE1=xxxxxxx
169
170## Set this to 1 if you wish to run the LTP TIRPC tests
171export RUN_LTP_TIRPC_TEST=0
172
173##Set this to 1 if you wish to run the dma_thread_diotest7 test
174export RUN_DMA_THREAD_DIOTEST7=0
175
176##Set this to 1 if you wish to run the Controller area network (CAN)
177##protocol support tests. You would also like to review the Kernel
178##config options need to be set for this at ltp/README
179export RUN_CONTROLLER_AREA_NETWORK_TESTS=0
180
181##Set this to 1 if you wish to run the SMACK Security tests
182## Remember that you cannot run both the SELINUX and SMACK tests at a time,
183## as both of them cannot be tested in the same running kernel
184export RUN_SMACK_SECURITY_TESTS=0
185
186export LTP_VERSION=`"${RUNLTP}" -e`
187export TEST_START_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
188export HARDWARE_TYPE=$(uname -i)
189export HOSTNAME=$(uname -n)
190export KERNEL_VERSION=$(uname -r)
191export HTML_OUTPUT_FILE_NAME=$LTP_VERSION_$HOSTNAME_$KERNEL_VERSION_$HARDWARE_TYPE_$TEST_START_TIME.html
192
193if ! cd "${LTPROOT}"; then
194	rc=$?
195	echo "${0##*/}: ERROR : Could not cd to ${LTPROOT}"
196	exit $rc
197fi
198
199## The First one i plan to run is the default LTP run ##
200## START => Test Series 1                             ##
201echo "Running Default LTP..."
202"${RUNLTP}" -g $HTML_OUTPUT_FILE_NAME
203printf "Completed running Default LTP\n\n\n"
204## END => Test Series 1                               ##
205
206## The next one i plan to run is ballista             ##
207## START => Test Series 2                             ##
208if [ $RUN_BALLISTA -eq 1 ]
209then
210	echo "Running Ballista..."
211	export TEST_START_TIME=`date +"%Y_%b_%d-%Hh_%Mm_%Ss"`
212	"${RUNLTP}" -f ballista -o $LTP_VERSION-BALLISTA_RUN_ON-$HOSTNAME-$KERNEL_VERSION-$HARDWARE_TYPE-$TEST_START_TIME.out
213	printf "Completed running Ballista\n\n\n"
214fi
215## END => Test Series 2                               ##
216
217## The next one i plan to run is open_posix_testsuite ##
218## START => Test Series 3                             ##
219if [ $RUN_OPENPOSIX -eq 1 ]
220then
221	echo "Running Open Posix Tests..."
222	(cd testcases/open_posix_testsuite; make)
223	printf "Completed running Open Posix Tests\n\n\n"
224fi
225## END => Test Series 3                               ##
226
227
228## The next one i plan to run is                      ##
229## ltp/testcases/kernel/mem/libmm/mm_core_apis        ##
230## START => Test Series 4                             ##
231if [ $RUN_MM_CORE_APIS -eq 1 ]
232then
233	echo "Initializing ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
234	# Check to see if User is Root
235	if [ $(id -ru) -ne 0 ]
236	then
237		echo -n "You need to be root to Install libmm and run "
238		echo -n "mem/libmm/mm_core_apis; aborting "
239		echo "ltp/testcases/kernel/mem/libmm/mm_core_apis"
240	else
241		if [ $LIBMM_INSTALLED -ne 1 ]
242		then
243			echo Installing libmm-1.4.2 .............
244			(cd /tmp;
245			 wget -c ftp://ftp.ossp.org/pkg/lib/mm/mm-1.4.2.tar.gz;
246			 tar -xzf mm-1.4.2.tar.gz;
247			 cd mm-1.4.2;
248			 ./configure && make all install)
249			rm -rf /tmp/mm-1.4.2*
250			echo "libmm-1.4.2 Installed ............."
251		else
252			echo "libmm-1.4.2 already installed in your system"
253		fi
254			echo -n "Running "
255			echo "ltp/testcases/kernel/mem/libmm/mm_core_apis ..."
256	   (make -C testcases/kernel/mem/libmm all install;
257	    $LTPROOT/testcases/bin/mm_core_apis; )
258	fi
259	printf "Completed running ltp/testcases/kernel/mem/libmm/mm_core_apis...\n\n\n"
260fi
261## END => Test Series 4                               ##
262
263
264## The next one i plan to run is                      ##
265## ltp/testcases/kernel/io/aio                        ##
266## START => Test Series 5                             ##
267if [ $RUN_AIOTESTS -eq 1 ]
268then
269	echo "Initializing ltp/testcases/kernel/io/aio ..."
270	# Check to see if User is Root
271	if [ $(id -ru) -ne 0 ]
272	then
273		echo -n "You need to be root to Install libaio-0.3.92 and run"
274		echo -n "ltp/testcases/kernel/io/aio; aborting "
275		echo "ltp/testcases/kernel/io/aio"
276	else
277		if [ $LIBAIO_INSTALLED -ne 1 ]
278		then
279			echo "Installing libaio-0.3.92............."
280			(cd /tmp;
281			 wget -c http://www.kernel.org/pub/linux/kernel/people/bcrl/aio/libaio-0.3.92.tar.gz;
282			 tar -xzf libaio-0.3.92.tar.gz;
283			 make -C libaio-0.3.92 all install)
284			rm -rf /tmp/libaio-0.3.92*
285			echo "libaio-0.3.92 Installed ............."
286		else
287			echo "libaio-0.3.92 already installed in your system"
288		fi
289		# XXX (garrcoop): this needs to be fixed so that it's callable
290		# via standalone runltp in a standard installed tree.
291		echo "Building & Running ltp/testcases/kernel/io/aio..."
292		(make -C testcases/kernel/io/aio all;
293		 ./aio01/aio01;
294		 ./aio02/runfstests.sh -a aio02/cases/aio_tio;
295		 make clean 1>&2 > /dev/null )
296		printf "Completed running ltp/testcases/kernel/io/aio...\n\n\n"
297	fi
298fi
299## END => Test Series 5                               ##
300
301## The next one i plan to run is                      ##
302## ltp/testcases/kernel/security/filecaps             ##
303## START => Test Series 6                             ##
304if [ $RUN_FILECAPS -eq 1 ]
305then
306	echo "Initializing ltp/testcases/kernel/security/filecaps ..."
307	# Check to see if User is Root
308	if [ $(id -ru) -ne 0 ]
309	then
310		echo -n "You need to be root to Install libcaps and run "
311		echo -n "ltp/testcases/kernel/security/filecaps; aborting "
312		echo "ltp/testcases/kernel/security/filecaps"
313	else
314		if [ $LIBCAPS_INSTALLED -ne 1 ]
315		then
316			echo "Installing libcaps............."
317			(cd /tmp;
318			 wget -c ftp://ftp.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.14.tar.gz;
319			 tar -xzf libcap-2.14.tar.gz;
320			 make -C libcap-2.14 all install)
321			rm -rf /tmp/libcap-2.14*
322			echo "libcaps Installed ............."
323		else
324			echo "libcaps already installed in your system"
325		fi
326		echo -n "Building & Running "
327		echo "ltp/testcases/kernel/security/filecaps"
328		make -C ltp/testcases/kernel/security/filecaps all install
329		"${RUNLTP}" -f filecaps
330		printf "Completed running ltp/testcases/kernel/io/aio...\n\n\n"
331
332	fi
333
334fi
335## END => Test Series 6                               ##
336
337
338## The next one i plan to run is tpm_tools            ##
339## START => Test Series 7                             ##
340"${RUNLTP}" -f tpm_tools
341## END => Test Series 7                               ##
342
343## The next one i plan to run is stress_cd tests
344## START => Test Series 9                             ##
345if [ $RUN_STRESS_CD -eq 1 ]
346then
347	"${RUNLTP}" -f io_cd
348fi
349## END => Test Series 9                               ##
350
351## The next one i plan to run is stress_floppy tests
352## START => Test Series 10                             ##
353if [ $RUN_STRESS_FLOPPY -eq 1 ]
354then
355	"${RUNLTP}" -f io_floppy
356fi
357## END => Test Series 10                               ##
358
359## The next one i plan to run is CPUHOTPLUG tests
360## START => Test Series 11                             ##
361if [ $RUN_CPU_HOTPLUG -eq 1 ]
362then
363	"${RUNLTP}" -f cpuhotplug
364fi
365## END => Test Series 11                               ##
366
367## The next one i plan to run are the LTP Network tests
368## START => Test Series 12                             ##
369if [ $RUN_LTP_NETWORK_TESTS -eq 1 ]
370then
371	(cd $LTPROOT/testscripts/; ./networktests.sh)
372fi
373## END => Test Series 12                               ##
374
375## The next one i plan to run are the LTP Network Stress tests
376## START => Test Series 13                             ##
377if [ $RUN_LTP_NETWORK_STRESS_TESTS -eq 1 ]
378then
379	(cd $LTPROOT/testscripts/; ./networkstress.sh)
380fi
381## END => Test Series 13                               ##
382
383
384## The next one i plan to run are the LTP ADP tests
385## START => Test Series 14                             ##
386if [ $RUN_LTP_ADP_TESTS -eq 1 ]
387then
388	(cd $LTPROOT/testscripts/; ./adp.sh -d 3 -n 100)
389fi
390## END => Test Series 14                               ##
391
392
393## The next one i plan to run are the LTP AUTOFS tests
394## START => Test Series 15                             ##
395if [ $RUN_LTP_AUTOFS1_TESTS -eq 1 ]
396then
397	if [ $DISK_PARTITION1 ]
398	then
399		(cd $LTPROOT/testscripts/; ./autofs1.sh $DISK_PARTITION1)
400	else
401		echo "Disk Partition not set. Aborting running AUTOFS1"
402	fi
403fi
404if [ $RUN_LTP_AUTOFS4_TESTS -eq 1 ]
405then
406	if [ $DISK_PARTITION1 ]
407	then
408		(cd $LTPROOT/testscripts/; ./autofs4.sh $DISK_PARTITION1)
409	else
410		echo "Disk Partition not set. Aborting running AUTOFS4"
411	fi
412fi
413## END => Test Series 15                               ##
414
415
416## The next one i plan to run are the LTP EXPORTFS tests
417## START => Test Series 16                             ##
418if [ $RUN_EXPORTFS_TESTS -eq 1 ]
419then
420	(cd $LTPROOT/testscripts/; ./exportfs.sh -h $NFS_SERVER1 -d $NFS_SERVER_DISK_PARTITION1 -t $NFS_SERVER_FS_TYPE1)
421fi
422## END => Test Series 16                               ##
423
424
425## The next one i plan to run the FS tests on READ ONLY File Systems
426## START => Test Series 17                             ##
427if [ $RUN_RO_ONLY_FS_TESTS -eq 1 ]
428then
429	(cd $READ_ONLY_DIRECTORY1; $LTPROOT/testscripts/test_robind.sh)
430fi
431## END => Test Series 17                               ##
432
433
434## The next one i plan to run the ISOFS tests
435## START => Test Series 18                             ##
436if [ $RUN_ISOFS_TESTS -eq 1 ]
437then
438	(cd $LTPROOT/testscripts/; ./isofs.sh)
439fi
440## END => Test Series 18                               ##
441
442
443## The next one i plan to run the DMMAPPER tests
444## START => Test Series 19                             ##
445if [ $RUN_DMMAPPER_TESTS -eq 1 ]
446then
447	(cd $LTPROOT/testscripts/; ./ltpdmmapper.sh -a $DISK_PARTITION2 -b $DISK_PARTITION3)
448fi
449## END => Test Series 19                               ##
450
451
452## The next one i plan to run the FSLVM tests
453## START => Test Series 20                             ##
454if [ $RUN_FSLVM_TESTS -eq 1 ]
455then
456	(cd $LTPROOT/testscripts/; ./ltpfslvm.sh -a $DISK_PARTITION4 -b $DISK_PARTITION5 -c $DISK_PARTITION6 -d $DISK_PARTITION7 -n $NFS_PARTITION1)
457fi
458## END => Test Series 20                               ##
459
460
461## The next one i plan to run the FSNOLVM tests
462## START => Test Series 21                             ##
463if [ $RUN_FSNOLVM_TESTS -eq 1 ]
464then
465	(cd $LTPROOT/testscripts/; ./ltpfsnolvm.sh -a $DISK_PARTITION4 -b $DISK_PARTITION5 -c $DISK_PARTITION6 -d $DISK_PARTITION7 -n $NFS_PARTITION1)
466fi
467## END => Test Series 21                               ##
468
469## The next one i plan to run the LTP SCSI DEBUG tests
470## START => Test Series 22                             ##
471if [ $RUN_LTP_SCSI_DEBUG_TEST -eq 1 ]
472then
473	(cd $LTPROOT/testscripts/; ./ltp-scsi_debug.sh)
474fi
475## END => Test Series 22                               ##
476
477## The next one i plan to run the LTP SYSFS tests
478## START => Test Series 23                             ##
479if [ $RUN_LTP_SYSFS_TEST -eq 1 ]
480then
481	(cd $LTPROOT/testscripts/; ./sysfs.sh -k $KERNEL_MODULE1)
482fi
483## END => Test Series 23                               ##
484
485## The next one i plan to run the LTP TIRPC tests
486## START => Test Series 24                             ##
487if [ $RUN_LTP_TIRPC_TEST -eq 1 ]
488then
489	"${RUNLTP}" -f rpctirpc
490fi
491## END => Test Series 24                               ##
492
493## The next one i plan to run the DMA_THREAD_DIOTEST7 tests
494## START => Test Series 25                             ##
495if [ $RUN_DMA_THREAD_DIOTEST7 -eq 1 ]
496then
497	"${RUNLTP}" -f test_dma_thread_diotest7
498fi
499## END => Test Series 25                               ##
500
501## The next one i plan to run the Controller area network
502## (CAN) protocol support tests
503## START => Test Series 26                             ##
504if [ $RUN_CONTROLLER_AREA_NETWORK_TESTS -eq 1 ]
505then
506	"${RUNLTP}" -f can
507fi
508## END => Test Series 26                               ##
509
510## The next one i plan to run the SMACK SECURITY tests
511## START => Test Series 27                             ##
512if [ $RUN_SMACK_SECURITY_TESTS -eq 1 ]
513then
514	"${RUNLTP}" -f smack
515fi
516## END => Test Series 27                               ##
517