diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-10-20 07:20:16 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-10-20 07:20:16 (GMT) |
commit | 59c9ae81b4911c6458cbe8a5ed78554bdcc82861 (patch) | |
tree | aab941294ccd67c8379f2dfb71ca107236d51f05 /test/w3c | |
parent | 9ba649b087df2bc161759e55549facc2f8f80878 (diff) | |
download | uscxml-59c9ae81b4911c6458cbe8a5ed78554bdcc82861.zip uscxml-59c9ae81b4911c6458cbe8a5ed78554bdcc82861.tar.gz uscxml-59c9ae81b4911c6458cbe8a5ed78554bdcc82861.tar.bz2 |
SCXML -> Promela skips intermediate explicit flat SCXML for ridiculous better memory footprint
Diffstat (limited to 'test/w3c')
-rwxr-xr-x | test/w3c/analyze_promela_tests.pl | 167 | ||||
-rw-r--r-- | test/w3c/graphs/data/pml_states.data | 84 | ||||
-rwxr-xr-x | test/w3c/graphs/promela-states.sh | 10 | ||||
-rwxr-xr-x | test/w3c/graphs/run_gnuplot.sh | 2 | ||||
-rw-r--r-- | test/w3c/run_promela_test.cmake | 2 |
5 files changed, 264 insertions, 1 deletions
diff --git a/test/w3c/analyze_promela_tests.pl b/test/w3c/analyze_promela_tests.pl new file mode 100755 index 0000000..5e1b96b --- /dev/null +++ b/test/w3c/analyze_promela_tests.pl @@ -0,0 +1,167 @@ +#!/usr/bin/perl -w + +use strict; +use File::Spec; +use File::Basename; +use Data::Dumper; + +my $toBaseDir = File::Spec->canonpath(dirname($0)); +my $outDir = File::Spec->catfile($toBaseDir, 'graphs'); +my $testResultFile; + +my @dataQuery; + +# iterate given arguments and populate $dataQuery +foreach my $argnum (0 .. $#ARGV) { + if ($argnum == $#ARGV) { + if (-f $ARGV[$argnum]) { + $testResultFile = $ARGV[$argnum]; + last; + } + if (-f File::Spec->catfile($toBaseDir, $ARGV[$argnum])) { + $testResultFile = File::Spec->catfile($toBaseDir, $ARGV[$argnum]); + last; + } + } + push(@dataQuery, \[split('\.', $ARGV[$argnum])]); +} + +if (!$testResultFile) { + $testResultFile = File::Spec->catfile($toBaseDir, "../../build/cli/Testing/Temporary/LastTest.log"); +} + +open(FILE, $testResultFile) or die $!; +mkdir($outDir) or die($!) if (! -d $outDir); + +my $test; +my $block; +my $currTest; +my $testIndex = 0; + +$/ = '-' x 58 . "\n"; + +while ($block = <FILE>) { + chomp($block); + + # Test Preambel ======== + if ($block =~ + / + \n? + (\d+)\/(\d+)\sTesting:\s(.*)\n + (\d+)\/(\d+)\sTest:\s(.*)\n + /x ) { + $currTest = $3; + $test->{$currTest}->{'name'} = $currTest; + $test->{$currTest}->{'number'} = $1; + $test->{$currTest}->{'total'} = $2; + $test->{$currTest}->{'index'} = $testIndex++; + + if ($currTest =~ /test(\d+\w?)\.scxml$/) { + $test->{$currTest}->{'w3c'} = $1; + } + + next; + } + + # Test Epilog ======== + if ($block =~ + / + Test\s(\S+)\sReason:\n + /x ) { + $test->{$currTest}->{'status'} = lc($1); + next; + } + + # Promela Test ======== + if ($block =~ + / + Approximate\sComplexity:\s(\d+)\n + Actual\sComplexity:\s(\d+)\n + /x ) { + $test->{$currTest}->{'flat'}->{'apprComplexity'} = $1; + $test->{$currTest}->{'flat'}->{'actualComplexity'} = $2; + + if ($block =~ /State-vector (\d+) byte, depth reached (\d+), errors: (\d+)/) { + $test->{$currTest}->{'pml'}->{'states'}->{'stateSize'} = $1; + $test->{$currTest}->{'pml'}->{'states'}->{'depth'} = $2; + $test->{$currTest}->{'pml'}->{'states'}->{'errors'} = $3; + } + if ($block =~ + / + \s+(\d+)\sstates,\sstored\s\((\d+)\svisited\)\n + \s+(\d+)\sstates,\smatched\n + \s+(\d+)\stransitions\s\(=\svisited\+matched\)\n + \s+(\d+)\satomic\ssteps\n + hash\sconflicts:\s+(\d+)\s\(resolved\) + /x ) { + $test->{$currTest}->{'pml'}->{'states'}->{'stateStored'} = $1; + $test->{$currTest}->{'pml'}->{'states'}->{'stateVisited'} = $2; + $test->{$currTest}->{'pml'}->{'states'}->{'stateMatched'} = $3; + $test->{$currTest}->{'pml'}->{'states'}->{'transitions'} = $4; + $test->{$currTest}->{'pml'}->{'states'}->{'atomicSteps'} = $5; + $test->{$currTest}->{'pml'}->{'hashConflicts'} = $6; + } + + if ($block =~ + / + \s+([\d\.]+)\sequivalent\smemory\susage\sfor\sstates.* + \s+([\d\.]+)\sactual\smemory\susage\sfor\sstates\n + \s+([\d\.]+)\smemory\sused\sfor\shash\stable\s\(-w(\d+)\)\n + \s+([\d\.]+)\smemory\sused\sfor\sDFS\sstack\s\(-m(\d+)\) + \s+([\d\.]+)\stotal\sactual\smemory\susage + /x ) { + $test->{$currTest}->{'pml'}->{'memory'}->{'states'} = $1; + $test->{$currTest}->{'pml'}->{'memory'}->{'actual'} = $2; + $test->{$currTest}->{'pml'}->{'memory'}->{'hashTable'} = $3; + $test->{$currTest}->{'pml'}->{'memory'}->{'hashLimit'} = $4; + $test->{$currTest}->{'pml'}->{'memory'}->{'dfsStack'} = $5; + $test->{$currTest}->{'pml'}->{'memory'}->{'dfsLimit'} = $6; + $test->{$currTest}->{'pml'}->{'memory'}->{'total'} = $7; + } + + next; + } + +} +close(FILE); + +if (@dataQuery > 0) { + while (my ($name, $data) = each $test) { + my $seperator = ""; + foreach (@dataQuery) { + my $currVal = $data; + my @query = @${$_}; + foreach (@query) { + my $dataKey = $_; + if (defined($currVal->{$dataKey})) { + $currVal = $currVal->{$dataKey}; + } else { + die("no key $dataKey in structure:\n" . Dumper($currVal)); + } + } + print $seperator . $currVal; + $seperator = ", "; + } + print "\n"; + } +} else { + while (my ($name, $data) = each $test) { + # get one $data into scope + print "Available Queries:\n"; + + sub dumpQueries() { + my $structure = shift; + my $path = shift || ""; + while (my ($name, $data) = each $structure) { + if (ref(\$data) eq "SCALAR") { + print "\t" . $path . $name . "\n"; + } else { + &dumpQueries($data, $path . $name . "."); + } + } + } + &dumpQueries($data); + exit; + } +} + diff --git a/test/w3c/graphs/data/pml_states.data b/test/w3c/graphs/data/pml_states.data new file mode 100644 index 0000000..7381008 --- /dev/null +++ b/test/w3c/graphs/data/pml_states.data @@ -0,0 +1,84 @@ +147, 108, 0.281, 3 +505, 116, 0.276, 6 +348, 108, 0.284, 3 +349, 204, 0.280, 4 +319, 108, 0.283, 3 +527, 196, 0.278, 5 +337, 196, 0.283, 3 +310, 108, 0.283, 5 +404, 108, 0.272, 10 +405, 108, 0.265, 13 +183, 196, 0.283, 3 +533, 124, 0.270, 9 +407, 108, 0.282, 4 +372, 108, 0.283, 4 +413, 108, 0.280, 11 +335, 196, 0.283, 3 +193, 108, 0.280, 4 +550, 108, 0.284, 4 +303, 108, 0.284, 3 +252, 108, 0.276, 8 +387, 108, 0.276, 18 +333, 196, 0.283, 3 +278, 108, 0.284, 4 +529, 196, 0.278, 5 +189, 108, 0.284, 3 +554, 108, 0.284, 5 +504, 124, 0.267, 11 +576, 108, 0.284, 13 +336, 108, 0.280, 4 +409, 108, 0.275, 6 +158, 108, 0.281, 4 +501, 108, 0.284, 3 +205, 204, 0.280, 4 +419, 108, 0.284, 3 +174, 108, 0.284, 3 +250, 100, 0.286, 6 +200, 108, 0.284, 3 +570, 108, 0.259, 10 +186, 204, 0.280, 4 +201, 108, 0.284, 3 +339, 196, 0.283, 3 +421, 108, 0.280, 5 +579, 108, 0.262, 8 +176, 204, 0.280, 4 +237, 108, 0.282, 7 +242, 108, 0.276, 9 +378, 108, 0.282, 4 +412, 108, 0.262, 8 +288, 108, 0.284, 3 +375, 108, 0.281, 4 +396, 112, 0.283, 3 +423, 108, 0.280, 4 +155, 124, 0.283, 3 +198, 204, 0.283, 3 +551, 116, 0.283, 4 +355, 108, 0.285, 4 +403c, 108, 0.279, 9 +416, 108, 0.279, 6 +417, 108, 0.279, 10 +330, 204, 0.279, 4 +376, 108, 0.284, 3 +506, 116, 0.274, 7 +187, 108, 0.284, 6 +318, 124, 0.281, 4 +149, 108, 0.282, 3 +364, 108, 0.279, 29 +173, 108, 0.284, 3 +279, 108, 0.284, 4 +495, 108, 0.280, 4 +287, 108, 0.284, 3 +406, 108, 0.267, 10 +323, 108, 0.284, 3 +553, 108, 0.284, 3 +153, 132, 0.282, 3 +190, 116, 0.280, 4 +377, 108, 0.278, 5 +403b, 108, 0.282, 6 +503, 116, 0.277, 5 +179, 196, 0.283, 3 +321, 108, 0.284, 3 +148, 108, 0.282, 3 +411, 108, 0.280, 4 +403a, 108, 0.275, 5 +144, 108, 0.281, 4 diff --git a/test/w3c/graphs/promela-states.sh b/test/w3c/graphs/promela-states.sh new file mode 100755 index 0000000..0cb7589 --- /dev/null +++ b/test/w3c/graphs/promela-states.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +ME=`basename $0` +DIR="$( cd "$( dirname "$0" )" && pwd )" + +mkdir ${DIR}/data &> /dev/null + +${DIR}/../analyze_promela_tests.pl w3c pml.states.stateSize pml.memory.actual flat.actualComplexity > ${DIR}/data/pml_states.data + +cat ${DIR}/data/pml_states.data | gnuplot -p -e 'plot "-" with lines,"-" with lines'
\ No newline at end of file diff --git a/test/w3c/graphs/run_gnuplot.sh b/test/w3c/graphs/run_gnuplot.sh new file mode 100755 index 0000000..26fe407 --- /dev/null +++ b/test/w3c/graphs/run_gnuplot.sh @@ -0,0 +1,2 @@ +#!/bin/bash +gnuplot test.plot > test.pdf diff --git a/test/w3c/run_promela_test.cmake b/test/w3c/run_promela_test.cmake index e46ab60..1200442 100644 --- a/test/w3c/run_promela_test.cmake +++ b/test/w3c/run_promela_test.cmake @@ -2,7 +2,7 @@ get_filename_component(TEST_FILE_NAME ${TESTFILE} NAME) -execute_process(COMMAND ${USCXML_TRANSFORM_BIN} -s -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.pml RESULT_VARIABLE CMD_RESULT) +execute_process(COMMAND ${USCXML_TRANSFORM_BIN} -i ${TESTFILE} -o ${OUTDIR}/${TEST_FILE_NAME}.pml RESULT_VARIABLE CMD_RESULT) if(CMD_RESULT) message(FATAL_ERROR "Error running ${USCXML_TRANSFORM_BIN}: ${CMD_RESULT}") endif() |