From c278ee50eeb59f74b960036803e3288c8b329c72 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 4 Jun 2009 17:30:23 +0200 Subject: [PATCH] More work supporting prefixes. --- selftest/README | 23 ++++++++++++++++------- selftest/Subunit.pm | 13 +++++++++++-- selftest/selftest.pl | 5 +++-- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/selftest/README b/selftest/README index 3fe6af5362a..83a3e6fd491 100644 --- a/selftest/README +++ b/selftest/README @@ -50,6 +50,8 @@ failure: [ REASON ] Announce that the test with the specified name failed. Optionally, it is possible to specify a reason it failed. +The alias "fail" will also work. + xfail ~~~~~ xfail: @@ -57,6 +59,8 @@ xfail: [ REASON ] Announce that the test with the specified name failed but that the failure was expected, e.g. it's a test for a known bug that hasn't been fixed yet. +Alternatively it is also possible to simply return "failure:" here but +specify in the samba4-knownfailures file that it is failing. skip ~~~~ @@ -66,14 +70,19 @@ skip: [ REASON ] Announce that the test with the specified name was skipped. Optionally a reason can be specified. -knownfail -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -knownfail: -knownfail: [ REASON ] +time +~~~~ +time: YYYY-MM-DD HH:mm:ssZ + +Announce the current time. This may be used to calculate the duration of +various tests. -Announce that the test with the specified name was run and failed as expected. -Alternatively it is also possible to simply return "failure:" here but -specify in the samba4-knownfailures file that it is failing. +prefix +~~~~~~ +prefix: Prefix + +Change the global prefix for test names. To unset the prefix, specify an empty +string. Environments ============ diff --git a/selftest/Subunit.pm b/selftest/Subunit.pm index 7feb5de9a43..ddecfe4369b 100644 --- a/selftest/Subunit.pm +++ b/selftest/Subunit.pm @@ -1,5 +1,5 @@ -# Simple Perl module for parsing the Subunit protocol -# Copyright (C) 2008 Jelmer Vernooij +# Perl module for parsing and generating the Subunit protocol +# Copyright (C) 2008-2009 Jelmer Vernooij # # 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 @@ -29,6 +29,7 @@ sub parse_results($$$$) my $unexpected_ok = 0; my $expected_fail = 0; my $unexpected_fail = 0; + my $prefix = ""; my $unexpected_err = 0; my $orig_open_len = $#$open_tests; @@ -39,6 +40,8 @@ sub parse_results($$$$) push (@$open_tests, $1); } elsif (/^time: (\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)Z\n/) { $msg_ops->report_time(mktime($6, $5, $4, $3, $2, $1)); + } elsif (/^prefix: (.*)\n/) { + $prefix = $1; } elsif (/^(success|successful|failure|fail|skip|knownfail|error|xfail): (.*?)( \[)?([ \t]*)\n/) { $msg_ops->control_msg($_); my $result = $1; @@ -133,4 +136,10 @@ sub report_time($) printf "time: %04d-%02d-%02d %02d:%02d:%02dZ\n", $year+1900, $mon, $mday, $hour, $min, $sec; } +sub prefix($) +{ + my ($prefix) = @_; + print "prefix: $prefix\n"; +} + 1; diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 43bdc7a8048..38ea0df39bd 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -217,6 +217,7 @@ sub run_testsuite($$$$$) my $pcap_file = setup_pcap($name); Subunit::report_time(time()); + Subunit::prefix($name); Subunit::start_test($name); my $ret = system("$cmd 2>&1"); @@ -226,10 +227,10 @@ sub run_testsuite($$$$$) } my $envlog = getlog_env($envname); if ($envlog ne "") { - print "ENVLOG: $envlog\n"; + print "envlog: $envlog\n"; } - print "CMD: $cmd\n"; + print "command: $cmd\n"; my $exitcode = $ret >> 8; -- 2.11.4.GIT