[Adding first hpc test that actually looks at hpc output. andy@galois.com**20070718045502] { adddir ./tests addfile ./tests/Makefile hunk ./tests/Makefile 1 +# This Makefile runs the tests using GHC's testsuite framework. It +# assumes the package is part of a GHC build tree with the testsuite +# installed in ../../../testsuite. + +TOP=../../../testsuite +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + addfile ./tests/all.T hunk ./tests/all.T 1 +setTestOpts(compose(only_compiler_types(['ghc']), + omit_ways(['ghci']))) + +# Set up the hpc common variable(s). +hpc = config.top + '/../utils/hpc/hpc'; + +test('hpc001', normal, compile_and_run_with_prefix, ['perl hpcrun.pl --hpc=' + hpc,'-fhpc']) addfile ./tests/hpc001.hs hunk ./tests/hpc001.hs 1 +main = print (const "Hello" "World") addfile ./tests/hpc001.stdout hunk ./tests/hpc001.stdout 1 +"Hello" + + + 75% expressions used (3/4) +100% boolean coverage (0/0) + 100% guards (0/0) + 100% 'if' conditions (0/0) + 100% qualifiers (0/0) +100% alternatives used (0/0) +100% local declarations used (0/0) +100% top-level declarations used (1/1) + + +---------- + 75% expressions used (3/4) +100% boolean coverage (0/0) + 100% guards (0/0) + 100% 'if' conditions (0/0) + 100% qualifiers (0/0) +100% alternatives used (0/0) +100% local declarations used (0/0) +100% top-level declarations used (1/1) + + +Writing: Main.hs.html + +
+    1 main = print (const "Hello" "World")
+
+
+ +Writing: hpc_index.html + + + + + + + + +
moduleTop Level DefinitionsAlternativesExpressions
%covered / total%covered / total%covered / total
  module Main100%1/1
0/0 75%3/4
  Program Coverage Total100%1/1
0/0 75%3/4
+Writing: hpc_index_fun.html + + + + + + + + +
moduleTop Level DefinitionsAlternativesExpressions
%covered / total%covered / total%covered / total
  module Main100%1/1
0/0 75%3/4
  Program Coverage Total100%1/1
0/0 75%3/4
+Writing: hpc_index_alt.html + + + + + + + + +
moduleTop Level DefinitionsAlternativesExpressions
%covered / total%covered / total%covered / total
  module Main100%1/1
0/0 75%3/4
  Program Coverage Total100%1/1
0/0 75%3/4
+Writing: hpc_index_exp.html + + + + + + + + +
moduleTop Level DefinitionsAlternativesExpressions
%covered / total%covered / total%covered / total
  module Main100%1/1
0/0 75%3/4
  Program Coverage Total100%1/1
0/0 75%3/4
+ + addfile ./tests/hpcrun.pl hunk ./tests/hpcrun.pl 1 +# +# This command wraps round a command execution, adding some hpc tests. +# + +while($ARGV[0] =~ /^--/) { + if ($ARGV[0] =~ /--hpc=(.*)/) { + shift @ARGV; + $HPC = $1; + } + if ($ARGV[0] =~ /--report/) { + shift @ARGV; + $REPORT = 1; + } +} + + +die "no option --hpc=* provided\n" if (!defined($HPC)); + +$binary = $ARGV[0]; + +system(@ARGV); +print "\n\n"; +system("$HPC report $binary.tix"); +print "\n\n"; +system("$HPC report $binary.tix --per-module"); +print "\n\n"; +open(MARKUP,"$HPC markup $binary.tix| "); +while() { + my $line = $_; + print $line; + if (/Writing: (\S+.html)/) { + system("cat $1"); + } +} +print "\n\n"; }