Commit fe4ec461 authored by Maximilien Colange's avatar Maximilien Colange

Merge branch 'tests'

parents 192864e4 9d76d86d
......@@ -35,7 +35,11 @@ clean-local:
# test part
TEST_EXTENSIONS = .data
DATA_LOG_DRIVER = ./teamcity-test-driver
DATA_LOG_COMPILER = ./run_test.pl
TESTS = \
tests/test_1.data
tests/test_1.data \
tests/test_2.data \
tests/test_3.data \
tests/test_4.data
......@@ -12,9 +12,10 @@ chomp $call;
my $nominal ;
while (my $line = <IN>) {
if ($line =~ /Result of verification/) {
$nomimal = $line;
last;
chomp $line;
if ($line =~ s/Result of verification is //) {
$nominal = $line;
last;
}
}
......@@ -32,7 +33,8 @@ my @results = `$call`;
while (my $line = shift(@results)) {
push (@outputs,$line);
if ($line =~ /Result of verification/) {
chomp $line;
if ($line =~ s/Result of verification is //) {
$tested = $line;
last;
}
......@@ -46,29 +48,21 @@ if ($? == 0) {
$failure = 1;
}
my $returnvalue;
if ( $nominal != $tested ) {
if ( $nominal ne $tested ) {
print "@outputs\n";
print "\n##teamcity[testFailed name='$title' message='regression detected' details='' expected='$nominal' actual='$tested'] \n";
print "Expected : $nominal Obtained : $tested \n";
$returnvalue = 1;
} elsif ( $failure ) {
print "@outputs\n";
print "\n##teamcity[testFailed name='$title' message='test did not exit properly' details='' expected='$nominal' actual='$tested'] \n";
print "Expected : $nominal Obtained : $tested \n";
my $exitval = $? >> 8;
print "test exited with value $exitval\n";
$returnvalue = 99;
} else {
# print "##teamcity[buildStatisticValue key='testDuration' value='@tested[2]']\n";
# print "##teamcity[buildStatisticValue key='testMemory' value='@tested[3]']\n";
print "Test successful : $title \n";
print "Control Values/Obtained : \n$title\n$nominal\n$tested\n";
$returnvalue = 0;
}
print "##teamcity[testFinished name='$title']\n";
exit $returnvalue;
#! /bin/sh
# teamcity-test-driver - basic testsuite driver script that reports tests results in
# TeamCity format
# this file derives from the basic autotools test-driver (cf copyright below)
# Copyright (C) 2011-2014 Free Software Foundation, Inc.
# Copyright (C) 2016 M. Colange, LSV -- ENS Cachan
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
scriptversion=2016-03-29.11; # UTC
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
set -u
usage_error ()
{
echo "$0: $*" >&2
print_usage >&2
exit 2
}
print_usage ()
{
cat <<END
Usage:
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--]
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
END
}
test_name= # Used for reporting.
log_file= # Where to save the output of the test script.
trs_file= # Where to save the metadata of the test run.
expect_failure=no
color_tests=no
enable_hard_errors=yes
while test $# -gt 0; do
case $1 in
--help) print_usage; exit $?;;
--version) echo "test-driver $scriptversion"; exit $?;;
--test-name) test_name=$2; shift;;
--log-file) log_file=$2; shift;;
--trs-file) trs_file=$2; shift;;
--color-tests) color_tests=$2; shift;;
--expect-failure) expect_failure=$2; shift;;
--enable-hard-errors) enable_hard_errors=$2; shift;;
--) shift; break;;
-*) usage_error "invalid option: '$1'";;
*) break;;
esac
shift
done
missing_opts=
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
if test x"$missing_opts" != x; then
usage_error "the following mandatory options are missing:$missing_opts"
fi
if test $# -eq 0; then
usage_error "missing argument"
fi
if test $color_tests = yes; then
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
red='' # Red.
grn='' # Green.
lgn='' # Light green.
blu='' # Blue.
mgn='' # Magenta.
std='' # No color.
else
red= grn= lgn= blu= mgn= std=
fi
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
TC_OUTPUT=`"$@" 2>&1 | awk '{if (/teamcity/) print ; else print > "$log_file"; }'`
estatus=$?
# estatus should always be 0
# if it is not the case, there was a problem in the test runner
# or maybe in the pipe/awk process
# in which case it is a hard error
if test $estatus -ne 0; then
if test $enable_hard_errors = yes; then
tweaked_estatus=99
else
tweaked_estatus=1
fi
else
# the result of the test is determined by teamcity report messages
# detect them to properly set the status of the test in 'make check' report
if echo "$TC_OUTPUT" | grep "##teamcity\[testIgnored"; then
tweaked_estatus=77
elif echo "$TC_OUTPUT" | grep "##teamcity\[testFailed"; then
tweaked_estatus=1
else
tweaked_estatus=0
fi
fi
case $tweaked_estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
# Report the test outcome and exit status in the logs, so that one can
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>$log_file
# Report outcome to console.
# do not forget to report Teamcity service messages
echo "$TC_OUTPUT"
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:
Simple Reachability, default options
Dummy model, reachability, BFS, regular inclusion test
./tiamo reach tests/bla.xml
Input automaton parsed, computing LU bounds
......
Dummy model, reachability, BFS, abstract inclusion test
./tiamo reach tests/bla.xml -incl sri
Input automaton parsed, computing LU bounds
discrete states: 2
states seen: 2
states explored: 1
max size of storage: 2
incl tests: 0
pos. incl tests: 0
Result of verification is Reachable!
Path is
Dummy model, reachability, DFS, regular inclusion test
./tiamo reach tests/bla.xml -order DFS
Input automaton parsed, computing LU bounds
discrete states: 2
states seen: 2
states explored: 1
max size of storage: 2
incl tests: 0
pos. incl tests: 0
Result of verification is Reachable!
Path is
Dummy model, reachability, DFS, abstract inclusion test
./tiamo reach tests/bla.xml -order DFS -incl sri
Input automaton parsed, computing LU bounds
discrete states: 2
states seen: 2
states explored: 1
max size of storage: 2
incl tests: 0
pos. incl tests: 0
Result of verification is Reachable!
Path is
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment