commit 64d0ee2dfaa1a0b33a69c1f29f361daf4324cf3c
parent 2c004efc083a3c316530532648177c2064db7ffe
Author: kyle <kyle@0x30.net>
Date: Sun, 15 Jan 2017 17:46:31 -0700
tt: save work end to end testing on openbsd
Diffstat:
3 files changed, 69 insertions(+), 38 deletions(-)
diff --git a/tt/git.sh b/tt/git.sh
@@ -6,16 +6,20 @@
. tt/package.subr 'devel' 'git'
plan 1
-pkg_check_deps
pkg_clean
+
+pkg_extract
+pkg_check_deps
pkg_build
-cp $workdist/config.log /tmp/config.log.good
-pkg_clean
+pkg_extract_instrumented
pkg_build_instrumented
+diff -u $workdist/config.log $workdir_inst/git-2.9.0/config.log
+diff -u $workdir/build.stdout $workdir_inst/build.stdout
+diff -u $workdir/build.stderr $workdir_inst/build.stderr
+
exit 0
-diag diff -u $workdist/config.log /tmp/config.log.good
# Writes too many shared memory files and quickly fills /tmp.
#pkg_test
diff --git a/tt/mutt.sh b/tt/mutt.sh
@@ -5,16 +5,25 @@
. tt/package.subr 'mail' 'mutt'
plan 11
-pkg_check_deps
pkg_clean
+
+pkg_extract
+pkg_check_deps
pkg_build
+#pkg_test
-pkg_clean
+pkg_extract_instrumented
pkg_build_instrumented
-exit 0
-pkg_test
-cat <<EOF > check.good
+# Diff various things between vanilla and instrumented build.
+ok 'is config.log identical' \
+ diff -u $workdist/config.log $workdir_inst/mutt-1.6.2/config.log
+ok 'is build stdout identical' \
+ diff -u $workdir/build.stdout $workdir_inst/build.stdout
+ok 'is build stderr identical' \
+ diff -u $workdir/build.stderr $workdir_inst/build.stderr
+
+cat <<EOF > $workdir_inst/check.good
Summary:
218 Source files used as input
73 Application link commands
@@ -37,9 +46,10 @@ Totals:
12082 Binary operators
558 Errors rewriting source
EOF
-pkg_check
+pkg_citrun_check
+exit 0
-cat <<EOF > tu_list.good
+cat <<EOF > $workdir_inst/tu_list.good
account.c 241
addrbook.c 246
alias.c 658
@@ -143,9 +153,10 @@ utf7.c 292
util.c 852
EOF
+exit 0
+
$workdir/mutt < /dev/null > /dev/null
-ok "is write_tus.pl exit code 0" \
- perl -I$treedir $treedir/tt/write_tus.pl ${CITRUN_PROCDIR}mutt_*
+ok "is write_tus.pl exit code 0" perl tt/write_tus.pl ${CITRUN_PROCDIR}mutt_*
pkg_check_manifest
pkg_clean
diff --git a/tt/package.subr b/tt/package.subr
@@ -1,32 +1,37 @@
-. tt/libtap.subr
+[ `uname` != "OpenBSD" ] && return 0
-if [ `uname` != "OpenBSD" ]; then
- skip_all "test not supported on this platform."
-fi
+set -u
+. tt/libtap.subr
# Script arguments give the path in the OpenBSD ports system.
portdir="/usr/ports/$1/$2"
workdist=`make -C $portdir show=WRKDIST`
workdir=`make -C $portdir show=WRKDIR`
+workdir_inst="${workdir}-citrun"
# This is used by the OpenBSD /usr/ports/infratstucture/.
-# PWD is evaluated right now, WRKDIR is deferred.
-portpath="${PWD}/compilers:\${WRKDIR}/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11R6/bin"
-
-diag "Current workdir is: $workdir"
+portpath="${PWD}/compilers:$workdir_inst/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11R6/bin"
export CITRUN_PROCDIR="$workdir/procdir/"
-time_ok()
+pkg_extract()
{
- start=`date +%s`
- ok "$@"
+ make -C $portdir extract > /dev/null
+ ok 'is make extract exit code 0' test $? -eq 0
+
+ diag "Building vanilla port in '$workdir'"
}
-pkg_check_deps()
+pkg_extract_instrumented()
{
- mkdir -p $workdir
+ make -C $portdir WRKDIR="$workdir_inst" extract > /dev/null
+ ok 'is make extract (citrun) exit code 0' test $? -eq 0
+
+ diag "Building instrumented port in '$workdir_inst'"
+}
+pkg_check_deps()
+{
make -C $portdir full-all-depends > $workdir/deps
make -C $portdir full-test-depends >> $workdir/deps
sort $workdir/deps | uniq > $workdir/deps.uniq
@@ -35,33 +40,39 @@ pkg_check_deps()
comm -2 -3 $workdir/deps.uniq $workdir/installed > $workdir/deps_needed
diff -u /dev/null $workdir/deps_needed || bail "dependencies not met"
+ diag "Port has `wc -l < $workdir/deps.uniq` dependencies, all are met"
}
pkg_build()
{
- mkdir -p $workdir
start=`date +%s`
+
make -C $portdir build > $workdir/build.stdout 2> $workdir/build.stderr
ok 'is make build exit code 0' test $? -eq 0
- diag Vanilla build took $((`date +%s` - start)) sec
+ diag "Vanilla build took $((`date +%s` - start)) sec"
}
pkg_build_instrumented()
{
- mkdir -p $workdir
start=`date +%s`
- make -C $portdir PORTPATH="$portpath" build \
- > $workdir/build_instrumented.stdout \
- 2> $workdir/build_instrumented.stderr
+
+ make -C $portdir PORTPATH="$portpath" WRKDIR="$workdir_inst" build \
+ > $workdir_inst/build.stdout \
+ 2> $workdir_inst/build.stderr
ok 'is instrumented make build exit code 0' test $? -eq 0
- diag Instrumented build took $((`date +%s` - start)) sec
+ diag "Instrumented build took $((`date +%s` - start)) sec"
}
pkg_test()
{
- time_ok 'is test successful' make -C $portdir test
+ start=`date +%s`
+
+ make -C $portdir test > $workdir/test.stdout 2> $workdir/test.stderr
+ ok 'is make test exit code 0' test $? -eq 0
+
+ diag "Vanilla test took $((`date +%s` - start)) sec"
}
pkg_test_instrumented()
@@ -70,15 +81,20 @@ pkg_test_instrumented()
make -C $portdir PORTPATH="${portpath}" test
}
-pkg_check()
+pkg_citrun_check()
{
- ok "is citrun_check successful" citrun_check $workdist
- #ok "is 'Milliseconds' sanitized" sed -i -e "/Milliseconds spent/d" $1
- #ok "citrun_check output diff" diff -u check.good check.out
+ citrun_check $workdir_inst > $workdir_inst/check.out
+ ok 'is citrun_check successful' test $? -eq 0
+
+ ok 'is Milliseconds sanitized' \
+ sed -i.bak -e "/Milliseconds spent/d" $workdir_inst/check.out
+ ok 'is citrun_check output identical' \
+ diff -u $workdir_inst/check.good $workdir_inst/check.out
}
pkg_clean()
{
make -C $portdir clean=all > /dev/null
ok 'is make clean exit code 0' test $? -eq 0
+ ok 'is rm -rf instrumented workdir exit code 0' rm -rf $workdir_inst
}