commit 8530b8bfb13d55f434973c2dc1158ac5a8c6e6cd
parent 68e20ffa5c8d7d3b0dd8fe5bfee75179c4eaefb0
Author: Kyle Milz <kyle@0x30.net>
Date: Wed, 31 Aug 2016 21:25:23 -0600
tt: switch ccitrunrun to libtap
Diffstat:
4 files changed, 111 insertions(+), 96 deletions(-)
diff --git a/bin/openbsd/ccitrunrun/Makefile b/bin/openbsd/ccitrunrun/Makefile
@@ -13,7 +13,7 @@ PERMIT_PACKAGE_CDROM = Yes
MASTER_SITES = ${HOMEPAGE}/
-WANTLIB += GL GLU GLEW glut c freetype m pthread z
+WANTLIB += GL GLU GLEW curses glut c freetype m pthread z
# -std=c++11
MODULES = gcc4
@@ -32,14 +32,14 @@ do-build:
-e "s,citrun_node_add,ccitrunrun_node_add," \
-e "s,citrun_major,ccitrunrun_major,g" \
-e "s,citrun_minor,ccitrunrun_minor,g" \
- src/runtime.h src/runtime.c \
- src/inst_action.cc src/inst_main.cc src/runtime_proc.cc
+ src/rt.h src/rt.c src/version.h \
+ src/inst_action.cc src/inst_main.cc src/process_file.cc
cd ${WRKSRC} && sed -i \
-e "s,citrun-inst,ccitrunrun-inst," \
-e "s,citrun-term,ccitrunrun-term," \
-e "s,citrun-gl,ccitrunrun-gl," \
-e "s,libcitrun,libccitrunrun," \
- Jamrules src/runtime.c src/Jamfile src/inst_main.cc src/check.in
+ Jamrules src/rt.c src/Jamfile src/inst_main.cc src/check.sh
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} jam -j4
do-test:
diff --git a/src/eg++ b/src/eg++
@@ -0,0 +1 @@
+citrun-inst
+\ No newline at end of file
diff --git a/tt/ccitrunrun.sh b/tt/ccitrunrun.sh
@@ -0,0 +1,105 @@
+#!/bin/sh
+#
+# Test that citrun run on itself works and the resulting binaries run.
+#
+. test/package.sh
+
+rm -rf /usr/ports/devel/ccitrunrun
+# Port contains some.. "customizations"
+cp -R bin/openbsd/ccitrunrun /usr/ports/devel/
+
+plan 14
+
+export NO_CHECKSUM=1
+pkg_set "devel/ccitrunrun"
+pkg_check_deps
+pkg_clean
+pkg_build
+
+cat <<EOF > check.good
+Summary:
+ 26 Source files used as input
+ 3 Application link commands
+ 14 Rewrite parse warnings
+ 26 Rewrite successes
+ 26 Rewritten source compile successes
+
+Totals:
+ 5263 Lines of source code
+ 234 Function definitions
+ 188 If statements
+ 26 For loops
+ 8 While loops
+ 3 Switch statements
+ 106 Return statement values
+ 1007 Call expressions
+ 16174 Total statements
+ 1554 Binary operators
+ 5 Errors rewriting source
+EOF
+pkg_check
+
+cat <<EOF > filelist.good
+src/demo-atlas.cc 149
+src/demo-font.cc 253
+src/demo-glstate.cc 153
+src/demo-shader.cc 210
+src/gl_buffer.cc 192
+src/gl_view.cc 526
+src/glyphy/glyphy-arcs.cc 321
+src/glyphy/glyphy-blob.cc 329
+src/glyphy/glyphy-extents.cc 90
+src/glyphy/glyphy-outline.cc 328
+src/glyphy/glyphy-sdf.cc 92
+src/glyphy/glyphy-shaders.cc 40
+src/matrix4x4.c 399
+src/process_dir.cc 42
+src/process_file.cc 111
+src/shm.cc 60
+src/trackball.c 338
+EOF
+
+$TEST_WRKDIST/src/ccitrunrun-gl &
+pid=$!
+
+sleep 1
+pkg_write_tus
+sort -o filelist.out filelist.out
+ok "ccitrunrun-gl translation unit manifest" diff -u filelist.good filelist.out
+
+kill $pid
+wait
+
+ok "rm procfile.shm" rm procfile.shm
+
+
+cat <<EOF > filelist.good
+src/inst_action.cc 118
+src/inst_frontend.cc 262
+src/inst_log.cc 47
+src/inst_main.cc 145
+src/inst_visitor.cc 191
+EOF
+
+$TEST_WRKDIST/src/ccitrunrun-inst
+
+pkg_write_tus
+sort -o filelist.out filelist.out
+ok "ccitrunrun-inst translation unit manifest" diff -u filelist.good filelist.out
+
+ok "rm procfile.shm" rm procfile.shm
+
+cat <<EOF > filelist.good
+src/process_dir.cc 42
+src/process_file.cc 111
+src/shm.cc 60
+src/term_main.cc 259
+EOF
+
+$TEST_WRKDIST/src/ccitrunrun-term
+
+pkg_write_tus
+sort -o filelist.out filelist.out
+ok "ccitrunrun-term translation unit manifest" diff -u filelist.good filelist.out
+
+pkg_clean
diff --git a/tt/ccitrunrun.t b/tt/ccitrunrun.t
@@ -1,92 +0,0 @@
-use strict;
-use warnings;
-use Cwd;
-use Expect;
-use Test::More tests => 49;
-use test::package;
-use test::viewer;
-
-$ENV{NO_CHECKSUM} = 1;
-system("rm -rf /usr/ports/devel/ccitrunrun; cp -R bin/openbsd/ccitrunrun /usr/ports/devel/");
-my $package = test::package->new("devel/ccitrunrun");
-my $viewer = test::viewer->new();
-
-system("./src/citrun-check /usr/ports/pobj/ccitrunrun-*");
-
-my $exp = Expect->spawn("/usr/ports/pobj/ccitrunrun-*/citrun-*/src/ccitrunrun-gl");
-$viewer->accept();
-$viewer->cmp_static_data([
- # file name lines instrumented sites
- ["/src/af_unix.cc", 166, 4207],
- ["/src/demo-atlas.cc", 149, 2045],
- ["/src/demo-font.cc", 253, 5954],
- ["/src/demo-glstate.cc", 153, 2040],
- ["/src/demo-shader.cc", 210, 2162],
- ["/src/gl_buffer.cc", 192, 2077],
- ["/src/gl_main.cc", 269, 6810],
- ["/src/gl_view.cc", 526, 2160],
- ["/src/glyphy/glyphy-arcs.cc", 321, 16125],
- ["/src/glyphy/glyphy-blob.cc", 329, 16090],
- ["/src/glyphy/glyphy-extents.cc",90, 15190],
- ["/src/glyphy/glyphy-outline.cc",328, 15663],
- ["/src/glyphy/glyphy-sdf.cc", 92, 15618],
- ["/src/glyphy/glyphy-shaders.cc",40, 15168],
- ["/src/matrix4x4.c", 399, 191],
- ["/src/runtime_proc.cc", 89, 6905],
- ["/src/trackball.c", 338, 46],
-]);
-$exp->hard_close();
-$viewer->close();
-
-$exp = Expect->spawn("/usr/ports/pobj/ccitrunrun-*/citrun-*/src/ccitrunrun-term");
-$viewer->accept();
-$viewer->cmp_static_data([
- # file name lines instrumented sites
- ["/src/af_unix.cc", 166, 4207],
- ["/src/runtime_proc.cc", 89, 6905],
- ["/src/term_main.cc", 264, 7658],
-]);
-$exp->hard_close();
-$viewer->close();
-
-$exp = Expect->spawn("/usr/ports/pobj/ccitrunrun-*/citrun-*/src/ccitrunrun-inst");
-$viewer->accept();
-
-$viewer->cmp_static_data([
- # file name lines instrumented sites
- [ "/src/inst_action.cc", 128, 63901 ],
- [ "/src/inst_main.cc", 398, 64187 ],
- [ "/src/inst_visitor.cc", 150, 54839 ],
-]);
-
-$exp->hard_close();
-
-open( my $fh, ">", "check.good" );
-print $fh <<EOF;
-Summary:
- 1 Log files found
- 28 Calls to the rewrite tool
- 25 Source files used as input
- 3 Application link commands
- 15 Rewrite parse warnings
- 25 Rewrite successes
- 25 Rewritten source compile successes
-
-Totals:
- 5481 Lines of source code
- 3 Functions called 'main'
- 238 Function definitions
- 207 If statements
- 27 For loops
- 12 While loops
- 3 Switch statements
- 106 Return statement values
- 1043 Call expressions
- 16602 Total statements
- 1563 Binary operators
- 6 Errors rewriting source
-EOF
-
-system("$ENV{CITRUN_TOOLS}/citrun-check /usr/ports/pobj/ccitrunrun-* > check.out");
-system("diff -u check.good check.out");
-$package->clean();