Index: ltp-full-20090531/testcases/realtime/lib/librttest.c =================================================================== --- ltp-full-20090531.orig/testcases/realtime/lib/librttest.c 2009-06-22 15:40:31.000000000 +0530 +++ ltp-full-20090531/testcases/realtime/lib/librttest.c 2009-06-29 12:45:27.000000000 +0530 @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -77,6 +78,7 @@ printf("librt standard options:\n"); printf(" -b(0,1) 1:enable buffered output, 0:diable buffered output\n"); printf(" -p(0,1) 0:don't use pi mutexes, 1:use pi mutexes\n"); + printf(" -m use mlockall\n"); printf(" -v[0-4] 0:no debug, 1:DBG_ERR, 2:DBG_WARN, 3:DBG_INFO, 4:DBG_DEBUG\n"); printf(" -s Enable saving stats data (default disabled)\n"); printf(" -c Set pass criteria\n"); @@ -103,9 +105,10 @@ size_t i; int c; opterr = 0; + int mlock = 0; char *all_options; - if (asprintf(&all_options, ":b:p:v:sc:%s", options) == -1) { + if (asprintf(&all_options, ":b:mp:v:sc:%s", options) == -1) { fprintf(stderr, "Failed to allocate string for option string\n"); exit(1); } @@ -135,6 +138,9 @@ case 'p': _use_pi = atoi(optarg); break; + case 'm': + mlock = 1; + break; case 'v': _dbg_lvl = atoi(optarg); break; @@ -161,6 +167,12 @@ printf("Priority Inheritance has been disabled for this run.\n"); if (use_buffer) buffer_init(); + if (mlock) { + if (mlockall(MCL_CURRENT|MCL_FUTURE)) { + perror("failed to lock memory\n"); + exit(1); + } + } calibrate_busyloop(); Index: ltp-full-20090531/testcases/realtime/doc/TODO =================================================================== --- ltp-full-20090531.orig/testcases/realtime/doc/TODO 2009-06-22 16:30:37.000000000 +0530 +++ ltp-full-20090531/testcases/realtime/doc/TODO 2009-06-22 16:30:48.000000000 +0530 @@ -2,8 +2,6 @@ o Add libjvmsim support to all tests, e.g. matrix_mult o Add help output (-h option) to all tests, e.g. matrix_mult o Use librt debug output mechanism in all tests, e.g. matrix_mult -o Add option to mlock_all() to all tests (probably as part of librt standard - options) o Add/integrate network tests o Add/integrate load tests Index: ltp-full-20090531/testcases/realtime/func/measurement/preempt_timing.c =================================================================== --- ltp-full-20090531.orig/testcases/realtime/func/measurement/preempt_timing.c 2009-06-22 16:32:41.000000000 +0530 +++ ltp-full-20090531/testcases/realtime/func/measurement/preempt_timing.c 2009-06-22 16:33:01.000000000 +0530 @@ -116,12 +116,6 @@ exit(-1); } - if (mlockall(MCL_CURRENT)) { - fprintf(stderr, "Couldn't lock memory\n"); - exit(1); - } - - for(j=0; j < INTERVALS; j++){ /* Collect samples */ for(i = 0; i < ITERATIONS; i++) Index: ltp-full-20090531/testcases/realtime/func/pi-tests/run_auto.sh =================================================================== --- ltp-full-20090531.orig/testcases/realtime/func/pi-tests/run_auto.sh 2009-06-25 13:29:35.000000000 +0530 +++ ltp-full-20090531/testcases/realtime/func/pi-tests/run_auto.sh 2009-06-25 13:33:57.000000000 +0530 @@ -12,21 +12,21 @@ # 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" +export LOG_FILE="$LOG_DIR/$LOG_FORMAT-testpi-1.log" +$SCRIPTS_DIR/run_c_files.sh $profile testpi-1 PYTHONPATH=../../ python parse-testpi1.py $LOG_FILE 2>&1 | tee -a $LOG_FILE +export LOG_FILE="$LOG_DIR/$LOG_FORMAT-testpi-2.log" $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 +export LOG_FILE="$LOG_DIR/$LOG_FORMAT-testpi-4.log" $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 - +export LOG_FILE="" $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 Index: ltp-full-20090531/testcases/realtime/scripts/run_c_files.sh =================================================================== --- ltp-full-20090531.orig/testcases/realtime/scripts/run_c_files.sh 2009-06-25 13:29:25.000000000 +0530 +++ ltp-full-20090531/testcases/realtime/scripts/run_c_files.sh 2009-06-25 13:36:03.000000000 +0530 @@ -10,7 +10,6 @@ # pattern "testid testname" and runs the corresponding test with the # args defined in the line. - [ $# -lt 2 ] && { echo >&2 "$0: too few arguments (at least two)" ; exit 1 ; } profile=$1 shift @@ -37,7 +36,9 @@ shift 2 params="$*" - LOG_FILE="$LOG_DIR/$LOG_FORMAT-${cmd}${params// /}.log" + if [ "$LOG_FILE" = "" ]; then + LOG_FILE="$LOG_DIR/$LOG_FORMAT-${cmd}${params// /}.log" + fi [ ! -d $LOG_DIR ] && mkdir -p $LOG_DIR (