Skip to contentSkip to conversation

Profiled tests.]

PATCH In review Subrata Modak 1 participant 2 messages May 19, 2008 – May 22, 2008 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Profiled tests.]

Looping in others as well.

Regards--
Subrata

-------- Forwarded Message --------
From: Gilles Carry <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: [PATCH 1/1] [REALTIME] Profiled tests.
Date: Mon, 19 May 2008 15:54:47 +0200

This patch is intentionnally global as splitting changes would not make sense. This includes:
- changes of scripts for automated tests to feature profiles
- individual changes for tests using automation
- a default profile (to be used as an example)
- documentation writing/modifying

---
 testcases/realtime/doc/AUTOMATED_RUN               |   46 +++++
 testcases/realtime/doc/HOWTO_ADD_TESTS             |   10 +-
 testcases/realtime/doc/run_auto.sh.tpl             |   17 ++
 testcases/realtime/func/gtod_latency/run_auto.sh   |    8 +-
 testcases/realtime/func/matrix_mult/run_auto.sh    |    8 +-
 .../realtime/func/periodic_cpu_load/run_auto.sh    |    6 +-
 testcases/realtime/func/pi-tests/run_auto.sh       |   18 ++-
 testcases/realtime/func/pi_perf/run_auto.sh        |    6 +-
 testcases/realtime/func/prio-preempt/run_auto.sh   |    6 +-
 testcases/realtime/func/prio-wake/run_auto.sh      |    6 +-
 .../realtime/func/pthread_kill_latency/run_auto.sh |    6 +-
 testcases/realtime/func/sched_football/run_auto.sh |    6 +-
 testcases/realtime/func/sched_jitter/run_auto.sh   |    6 +-
 testcases/realtime/func/sched_latency/run_auto.sh  |    6 +-
 testcases/realtime/func/thread_clock/run_auto.sh   |    6 +-
 testcases/realtime/profiles/default                |   60 +++++++
 testcases/realtime/run.sh                          |  179 +++++++++++---------
 testcases/realtime/scripts/run_c_files.sh          |   68 +++++---
 testcases/realtime/scripts/setenv.sh               |    4 +
 .../realtime/testcases/realtime/doc/AUTOMATED_RUN  |   46 +++++
 20 files changed, 390 insertions(+), 128 deletions(-)
 create mode 100644 testcases/realtime/doc/AUTOMATED_RUN
 create mode 100644 testcases/realtime/doc/run_auto.sh.tpl
 create mode 100644 testcases/realtime/profiles/default
 create mode 100644 testcases/realtime/testcases/realtime/doc/AUTOMATED_RUN
testcases/realtime/doc/AUTOMATED_RUN new file +46 -0
new file mode 100644
index 0000000..7cf7a56
@@ -0,0 +1,46 @@
+This explains how the automatic testing works with profile support.
+
+Profiles help users maintaining sets of tests for specific requirements.
+Each profile is defined in a file.
+All profiles are stored in the <RT_TESTS_ROOT>/profile/ directory.
+
+
+I. Automated tests in specific test-diretory.
+
+Tests can be run for one directory by running ./run_auto.sh in the wanted dir.
+run_auto.sh is customizable and contains a command line for each test to be run.
+(see template run_auto.sh.tpl in this dir)
+run_auto.sh can be invoked with an argument which is the profile to use.
+profile/ dir holds a file for each defined profile.
+A profile has a number of lines for which each test executable can be run
+with different arguments.
+Invoking run_auto.sh with no arg uses the default profile.
+Currently, the default profile does not alter the default values defined
+individually in each test.
+
+Example:
+In dir func/prio-preempt, user runs ./run_auto.sh prf1
+Since run_auto.sh contains this line:
+	$SCRIPTS_DIR/run_c_files.sh $profile prio-preempt
+
+run_c_files.sh will look into profile/prf1 for lines like this:
+	func/prio-preempt prio-preempt -c 2 -j
+	func/prio-preempt prio-preempt -c 1
+
+and run the following commands from the func/prio-preempt dir:
+	prio-preempt -c 2 -j
+	prio-preempt -c 1
+
+
+
+II. All automated tests
+
+Tests can also be run with <RT_TESTS_ROOT>/run.sh. User may choose whatever
+test range he wants. (all, func, perf... see README)
+run.sh searches for run_auto.sh files in the wanted area and runs them one
+by one.
+To use a profile other than default, use argument '-p <myprofile>'.
+
+Examples:
+	./run.sh -p prf1 -t func	# Uses prf1 profile
+	./run.sh -t func		# Uses default profile
testcases/realtime/doc/HOWTO_ADD_TESTS +7 -3
index 8bd5c4d..2f51df2 100644
@@ -10,13 +10,17 @@ rt-test - HOWTO_ADD_TESTS
 	  individually as an available test.
 	- run "run.sh list" to see available tests
 
-3. If you are creating a new subdirectory:
+2. If you are creating a new subdirectory:
    Provide:
 	- your test files
 	- your GNUMakefile.am
-	- your run_auto.sh script
+	- your run_auto.sh script (use template: doc/run_auto.sh.tpl)
 
-   Test the following:
+3. Modify tests profiles if to be run automatically
+	- profile/default
+	- other profiles if needed
+
+4. Test the following:
 	sh autogen.sh; ./configure, make, naturally
 	run.sh list
 	run.sh clean
testcases/realtime/doc/run_auto.sh.tpl new file +17 -0
new file mode 100644
index 0000000..2238916
@@ -0,0 +1,17 @@
+#! /bin/bash
+
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
+if [ ! $SCRIPTS_DIR ]; then
+        # assume we're running standalone
+        export SCRIPTS_DIR=../../scripts/
+fi
+
+source $SCRIPTS_DIR/setenv.sh
+
+# Warning: tests args are now set in profiles
+
+# Customize below. One line per test.
+$SCRIPTS_DIR/run_c_files.sh $profile testexecutable1
+# $SCRIPTS_DIR/run_c_files.sh $profile testexecutable2
testcases/realtime/func/gtod_latency/run_auto.sh +6 -2
index 130675c..1e181e4 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,8 +10,9 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "gtod_latency"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile gtod_latency
 
 # This is only for hostility testing
-#$SCRIPTS_DIR/run_c_files.sh "gtod_infinite"
+#$SCRIPTS_DIR/run_c_files.sh $profile gtod_infinite
 
testcases/realtime/func/matrix_mult/run_auto.sh +5 -3
index 5403089..8713ca3 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,6 +10,5 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "matrix_mult"
-
-
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile matrix_mult
testcases/realtime/func/periodic_cpu_load/run_auto.sh +5 -1
index 05e3131..334174e 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,4 +10,5 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "periodic_cpu_load:periodic_cpu_load_single"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile periodic_cpu_load periodic_cpu_load_single
testcases/realtime/func/pi-tests/run_auto.sh +11 -7
index 82fec4c..8365943 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,22 +10,23 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "testpi-0"
-$SCRIPTS_DIR/run_c_files.sh "testpi-1"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile testpi-0
+$SCRIPTS_DIR/run_c_files.sh $profile testpi-1
 
 LOG_FILE="$LOG_DIR/$LOG_FORMAT-testpi-1.log"
 PYTHONPATH=../../  python parse-testpi1.py $LOG_FILE 2>&1 | tee -a $LOG_FILE
 
-$SCRIPTS_DIR/run_c_files.sh "testpi-2"
+$SCRIPTS_DIR/run_c_files.sh $profile testpi-2
 LOG_FILE="$LOG_DIR/$LOG_FORMAT-testpi-2.log"
 PYTHONPATH=../../  python parse-testpi2.py $LOG_FILE 2>&1 | tee -a $LOG_FILE
 
-$SCRIPTS_DIR/run_c_files.sh "testpi-4"
+$SCRIPTS_DIR/run_c_files.sh $profile testpi-4
 LOG_FILE="$LOG_DIR/$LOG_FORMAT-testpi-4.log"
 PYTHONPATH=../../  python parse-testpi1.py $LOG_FILE 2>&1 | tee -a $LOG_FILE 
 
 
 
-$SCRIPTS_DIR/run_c_files.sh "testpi-5"
-$SCRIPTS_DIR/run_c_files.sh "testpi-6"
-$SCRIPTS_DIR/run_c_files.sh "sbrk_mutex"
+$SCRIPTS_DIR/run_c_files.sh $profile testpi-5
+$SCRIPTS_DIR/run_c_files.sh $profile testpi-6
+$SCRIPTS_DIR/run_c_files.sh $profile sbrk_mutex
testcases/realtime/func/pi_perf/run_auto.sh +5 -1
index 29b16a9..ee590d3 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,4 +10,5 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "pi_perf"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile pi_perf
testcases/realtime/func/prio-preempt/run_auto.sh +5 -1
index 728f106..5dea246 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,6 +10,7 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "prio-preempt"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile prio-preempt
 
 
testcases/realtime/func/prio-wake/run_auto.sh +5 -1
index eb38b26..31433bf 100755
@@ -1,8 +1,12 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
 fi
 source $SCRIPTS_DIR/setenv.sh
-$SCRIPTS_DIR/run_c_files.sh "prio-wake"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile prio-wake
testcases/realtime/func/pthread_kill_latency/run_auto.sh +5 -1
index b2fcbad..d2c543b 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,6 +10,7 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "pthread_kill_latency"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile pthread_kill_latency
 
 
testcases/realtime/func/sched_football/run_auto.sh +5 -1
index e161e66..3694fce 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,7 +10,8 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "sched_football"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile sched_football
 
 LOG_FILE="$LOG_DIR/$LOG_FORMAT-sched_football.log"
 PYTHONPATH=../../  python parse-football.py $LOG_FILE 2>&1 | tee -a $LOG_FILE
testcases/realtime/func/sched_jitter/run_auto.sh +5 -1
index 547b844..c2d1be9 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,4 +10,5 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "sched_jitter"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile sched_jitter
testcases/realtime/func/sched_latency/run_auto.sh +5 -1
index 601e3fb..a67a8f0 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,4 +10,5 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "sched_latency -d 1 -t 5"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile sched_latency -d 1 -t 5
testcases/realtime/func/thread_clock/run_auto.sh +5 -1
index cf0ce3d..529ff16 100755
@@ -1,5 +1,8 @@
 #! /bin/bash
 
+profile=${1:-default}
+
+cd $(dirname $0) # Move to test directory
 if [ ! $SCRIPTS_DIR ]; then
         # assume we're running standalone
         export SCRIPTS_DIR=../../scripts/
@@ -7,4 +10,5 @@ fi
 
 source $SCRIPTS_DIR/setenv.sh
 
-$SCRIPTS_DIR/run_c_files.sh "tc-2"
+# Warning: tests args are now set in profiles
+$SCRIPTS_DIR/run_c_files.sh $profile tc-2
testcases/realtime/profiles/default new file +60 -0

60 lines not on this page · raw message

testcases/realtime/run.sh +97 -82

241 lines not on this page · raw message

testcases/realtime/scripts/run_c_files.sh +46 -22

81 lines not on this page · raw message

testcases/realtime/scripts/setenv.sh +4 -0
index 235ff9e..7532353 100755
@@ -12,7 +12,11 @@ if [ -z "$PARENT" ]; then
 fi
 
 export TESTS_DIR=$PARENT/$TESTSUITE_NAME
+# TEST_REL_DIR is used as a unique id for a test dir
+export TEST_REL_DIR=${PWD#$TESTS_DIR/}
 export SCRIPTS_DIR=$TESTS_DIR/scripts
+export PROFILES_DIR=$TESTS_DIR/profiles
 export LOG_DIR=$TESTS_DIR/logs
 export ARGUMENTS_INPUT_ERROR=25
 export LOG_FORMAT="`hostname --short`-`uname -m`-`uname -r`-`date +%Y-%d-%m`"
+
testcases/realtime/testcases/realtime/doc/AUTOMATED_RUN new file +46 -0

46 lines not on this page · raw message

#3 lore raw
In reply to a message not in the archive

Thanks Gilles for the Patch and thanks Ankita or reviewing the same. The same has been merged to LTP.

Regards--
Subrata

Quoted 31 lines · Gilles Carry

Hello Ankita,

Quoted 8 lines · Ankita Garg

I like the idea. It helps making testing infrastructure to be generic and easy to extend.

I might be missing something, or it could be that it is a TO-DO item, but the patch looks incomplete...the testcases dont yet support the '-c' option. Also, the parsers do not take the profiles into account. As I said before, this could just be your first step towards completing the entire infrastructure and you might have the rest in your To-Do..

Actually, the '-c' option is not mandatory for this patch to work since the profiles can take any command line.
Arguments are not interpreted by the scripts which run the command lines as found in the profile.

In a previous patch, I added that '-c' argument only to tests that feature pass/fail criteria. Some tests don't feature it. This is why you don't find this option everywhere.

Does this answer your question?

Which parser are you refering to?

Quoted 2 lines

Otherwise, the patch looks fine to me. Applied it and seems to be working fine.

Thanks for your feedback.

Gilles.