Skip to content

Commit 40f0a9c

Browse files
install autotest related scripts
1 parent ec95005 commit 40f0a9c

File tree

6 files changed

+88
-121
lines changed

6 files changed

+88
-121
lines changed

doc/install.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
kncc18$ ./configure --prefix=/other/ltp \
6868
> --with-open-posix-testsuite \
6969
> --with-realtime-testsuite \
70-
> CC="icc -mmic" LDFLAGS="-Wl,-rpath=/opt/ppos/attached/lib" \
70+
> --with-tirpc \
71+
> CC=gcc \
7172
> HOSTCC="gcc -DMCEXEC_ENABLED" --host=x86_64-unknown-linux-gnu
7273

7374
* prefix は LTP のインストール先ディレクトリです。このディレクトリは、

tools/gen_autotest_scripts.awk

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/awk -f
2+
3+
# Usage: cd <ltp-install>/bin && cat ../runtest/{syscalls,ipc,mm,hugetlb} | ./gen_autotest_scripts.awk
4+
# This puts scritps on <autotest>/data/scripts/
5+
#
6+
# Usage of the generated scripts:
7+
# McKernel run: bash -x <autotest>/data/script/ltp-<test_name>
8+
9+
BEGIN {
10+
"dirname " ARGV[0] | getline dir;
11+
"cd " dir "/../../.. && pwd -P" | getline autotest_home;
12+
"cd " dir "/.. && pwd -P" | getline ltp_install;
13+
14+
scriptdir = sprintf("%s/data/scripts", autotest_home);
15+
system("rm -f " scriptdir "/ltp-*");
16+
}
17+
18+
!/^#|^$/ {
19+
testcase = $1;
20+
command_line = $0;
21+
script = sprintf("%s/ltp-%s", scriptdir, testcase);
22+
23+
print "#!/bin/sh\n" > script;
24+
25+
print "# Define WORKDIR, DATADIR, MCKINSTALL etc." >> script;
26+
printf(". %s/bin/config.sh\n", autotest_home) >> script;
27+
28+
printf("recorddir=$WORKDIR/output/ltp-%s\n", testcase) >> script;
29+
30+
printf("command_line='%s'\n\n", command_line) >> script;
31+
printf(". %s/bin/run.sh", ltp_install) >> script;
32+
33+
system("chmod +x " script);
34+
}

tools/run.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/sh
2+
3+
SCRIPT_PATH=$(readlink -m "${BASH_SOURCE[0]}")
4+
AUTOTEST_HOME="${SCRIPT_PATH%/*/*/*/*}"
5+
export LTPROOT=$AUTOTEST_HOME/ltp/install
6+
7+
ihkosctl=$MCKINSTALL/sbin/ihkosctl
8+
9+
# Prepare working directory
10+
rm -rf $recorddir && mkdir -p $recorddir
11+
12+
$ihkosctl 0 clear_kmsg
13+
14+
# Run LTP
15+
pushd $recorddir > /dev/null
16+
echo "$command_line" > $recorddir/command_line
17+
sudo bash -c " LTPMCEXEC=$MCKINSTALL/bin/mcexec MCEXEC_TIMEOUT=10800 MC_RESET_EACHTIME=0 $LTPROOT/runltp -l LTP_RUN.log -f $recorddir/command_line"
18+
exit_code=$?
19+
popd > /dev/null
20+
21+
# OK/NG decision
22+
rc=0
23+
if [[ $exit_code != 0 ]]; then
24+
rc=1
25+
fi
26+
27+
# Check if kmsg is empty
28+
$MCKINSTALL/sbin/ihkosctl 0 kmsg > $recorddir/kmsg.log
29+
if [ "`cat $recorddir/kmsg.log | wc -l`" -ne 1 ]; then
30+
echo "$(basename $0): WARNING: kmsg isn't empty."
31+
fi
32+
33+
# Check if process/thread structs remain
34+
show_struct_process_or_thread="$recorddir/show_struct_process_or_thread.log"
35+
$ihkosctl 0 clear_kmsg
36+
$ihkosctl 0 ioctl 40000000 1
37+
$ihkosctl 0 ioctl 40000000 2
38+
$ihkosctl 0 kmsg > $show_struct_process_or_thread
39+
40+
nprocs=`awk '$4=="processes"{print $3}' $show_struct_process_or_thread`
41+
if [ -n $nprocs ] && [ "$nprocs" != "0" ]; then
42+
echo "$(basename $0): INFO: $nprocs process(es) remaining"
43+
rc=1
44+
fi
45+
46+
nthreads=`awk '$4=="threads"{print $3}' $show_struct_process_or_thread`
47+
if [ -n $nthreads ] && [ "$nthreads" != "0" ]; then
48+
echo "$(basename $0): INFO: $nprocs thread(s) remaining"
49+
rc=1
50+
fi
51+
52+
exit $rc

util/gen_autotest_scripts.awk

Lines changed: 0 additions & 46 deletions
This file was deleted.

util/linux_run.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

util/run.sh

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)