From: Wei Liu <wei.liu2@citrix.com>
To: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
Wei Liu <wei.liu2@citrix.com>
Subject: Re: [OSSTEST PATCH RFC 11/14] Introduce ts-xtf-run
Date: Thu, 4 Aug 2016 15:40:37 +0100 [thread overview]
Message-ID: <20160804144037.GM32096@citrix.com> (raw)
In-Reply-To: <22435.12995.309804.271@mariner.uk.xensource.com>
On Thu, Aug 04, 2016 at 01:19:15PM +0100, Ian Jackson wrote:
> Wei Liu writes ("[OSSTEST PATCH RFC 11/14] Introduce ts-xtf-run"):
> > This is the main script for running XTF. It will first perform
> > selftest, and then run each XTF test case as a substep.
> >
> > It does the following things:
> >
> > 1. Run self tests for individual environment and record the result.
> > 2. Collect tests according to available environments.
> > 3. Run the collected tests one by one.
> >
> > The script may exit early if it detects the test host is down or
> > xtf-runner returns non-recognisable exit code.
> ...
> > + foreach my $e (split('\n', $output)) {
> > + push @all_environments, $e
> > + }
>
> Why not
> push @all_environments, split /\n/, $output;
> ?
>
> (NB split takes a pattern - a regexp - not a string. Your code
> provides a literal string which is then used as a regexp.)
>
> (Another occurrence of this pattern, later.)
>
Ack.
> > +# Call the runner on one test case, generate a substep for it in final test
> > +# report. Return runner exit code to caller. May exit the script early if
> > +# things go really bad.
> > +sub do_one_test ($) {
> > + my ($name) = @_;
> > + my $tid = "xtf/$name";
> > + my $cmd = "xtf-runner $name";
> > +
> > + substep_start($tid, $cmd);
> > + my $output = target_cmd_output_root($ho, <<END, 600);
> > + $runner $name 1>&2; echo \$\?
> > +END
> ^ this second \ is superfluous
> > + my ($ret) = $output =~ /(\d+)/;
>
> die unless the pattern matches.
Ack.
>
> This code seems to be lacking the error handling we discussed. In
> particular, if target_cmd_output_root fails (because the dom0
> crashed), target_cmd_output_root will die. The script will exit
> nonzero and the step will be left `running'.
>
> > + # If the host doesn't respond after a test case, always make this substep
> > + # fail and exit the script early with 0
> > + my $msg = target_ping_check_up($ho);
>
> I think it would be better to use
> target_cmd_output($ho, 'echo ok.');
> than target_ping_check_up.
>
> There are some kinds of failure which leave the host responding to
> ping but not actually usefully alive.
>
> > + # If xtf result can't be recognised, always make this substep fail and exit
> > + # the script early with status 0.
> > + if (!xtf_result_defined($ret)) {
> > + substep_finish($tid, "fail");
> > + exit 0;
>
> The lack of use of `eval' (and appropriate use of `die') has resulted
> in a lot of explicit repetition of this error path.
>
> Please arrange that all problems which ought to cause "record step as
> `fail' and run no more tests" are handled by:
>
> - having the code which detects the problem calling die
> - that die being caught by a single eval instance
> - the code after the eval handling all exceptions that way
>
I will see what I can do regarding this. I'm not very familiar with
perl, will need to read some docs first.
> Also there is a latent bug here. You have xtf_result_defined accept
> exit statuses 1 and 2, but those are actually not defined exit
> statuses for the xtf runner.
FAOD, 1 and 2 are defined xtf exit statuses -- reserved for anything
python interpreter related. But I think this is going to be moot because
they are going to be mapped to fail anyway.
>
> I think that this would be best fixed by using something like this:
>
> +sub xtf_result_to_osstest_result ($) {
> + my ($xret) = @_;
> +
> + return "pass" if $xret == 0;
> + return "skip" if $xret == 3;
> + return "fail" if $xret == 4;
> + return "fail" if $xret == 5;
> + die "xtf runner gave unexpected exit status $xret";
> +}
>
> (And, obviously, calling it within the eval.)
>
> Then you can abolish xtf_result_defined.
>
> And another thing: AFAICT there is nothing that prints the XTF exit
> status. You need at least to report the numerical exit status;
> ideally you would print some human-readable interpretation of it.
>
> The person reading the logs may not be familiar with osstest or xtf.
> They ought to be told the xtf name for the exit status as well as the
> osstest mapping of it.
>
The XTF exit status is already available in the log, as is the
osstest result (in substep status line).
I guess you want them on the same line? One logm would do.
> > +# Run selftest for each environment, record the ones that are
> > +# funtional to get maximum coverage.
> ^c
>
> > +sub get_tests_list () {
> > + foreach my $e (sort @environments) {
> > + my $output = target_cmd_output_root($ho, <<END);
> > + $runner --list $e --all --host
> > +END
> > + foreach my $t (split('\n', $output)) {
> > + push @tests, $t
> > + }
>
> It might be worth recording the environment for each test, for the
> log, unless the xtf runner prints that.
>
It is encoded in test case name.
Wei.
> Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-08-04 14:40 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-04 8:45 [OSSTEST PATCH RFC 00/14] Integrate XTF into OSSTest Wei Liu
2016-08-04 8:45 ` [OSSTEST PATCH RFC 01/14] ts-xen-build: always compile in FEP support Wei Liu
2016-08-04 11:46 ` Ian Jackson
2016-08-04 11:49 ` Wei Liu
2016-08-04 11:53 ` Andrew Cooper
2016-08-04 12:03 ` Wei Liu
2016-08-04 13:28 ` Andrew Cooper
2016-08-04 14:03 ` Wei Liu
2016-08-04 14:08 ` Andrew Cooper
2016-08-04 15:22 ` Ian Jackson
2016-08-04 15:26 ` Wei Liu
2016-08-04 15:36 ` Ian Jackson
2016-08-04 8:45 ` [OSSTEST PATCH RFC 02/14] TestSupport: factor out target_jobdir_subdir Wei Liu
2016-08-04 11:47 ` Ian Jackson
2016-08-04 8:45 ` [OSSTEST PATCH RFC 03/14] DO NOT APPLY ts-leak-check: sleep 5 seconds before collecting stuff Wei Liu
2016-08-04 8:45 ` [OSSTEST PATCH RFC 04/14] ap-common: add xtf tree Wei Liu
2016-08-04 11:49 ` Ian Jackson
2016-08-04 13:34 ` Andrew Cooper
2016-08-04 15:21 ` Ian Jackson
2016-08-04 15:43 ` Andrew Cooper
2016-08-04 16:13 ` Ian Jackson
2016-08-04 18:20 ` Andrew Cooper
2016-08-04 14:06 ` Wei Liu
2016-08-04 8:45 ` [OSSTEST PATCH RFC 05/14] DO NOT APPLY point xtf to my personal tree Wei Liu
2016-08-04 8:45 ` [OSSTEST PATCH RFC 06/14] Introduce ts-xtf-build Wei Liu
2016-08-04 11:52 ` Ian Jackson
2016-08-04 11:57 ` Wei Liu
2016-08-04 15:04 ` Ian Jackson
2016-08-04 8:45 ` [OSSTEST PATCH RFC 07/14] sg-run-job: create xtf build recipe Wei Liu
2016-08-04 11:53 ` Ian Jackson
2016-08-04 8:45 ` [OSSTEST PATCH RFC 08/14] Introduce ts-xtf-install Wei Liu
2016-08-04 11:54 ` Ian Jackson
2016-08-04 11:58 ` Wei Liu
2016-08-04 15:17 ` [OSSTEST PATCH RFC 06/14] Introduce ts-xtf-build [and 1 more messages] Ian Jackson
2016-08-04 15:35 ` Wei Liu
2016-08-04 16:05 ` Ian Jackson
2016-08-04 18:10 ` Andrew Cooper
2016-08-04 18:12 ` Ian Jackson
2016-08-04 8:45 ` [OSSTEST PATCH RFC 09/14] mfi-common: create xtf build job for 4.8 onwards Wei Liu
2016-08-04 11:59 ` Ian Jackson
2016-08-04 14:12 ` Wei Liu
2016-08-04 8:45 ` [OSSTEST PATCH RFC 10/14] Introduce ts-xtf-fep Wei Liu
2016-08-04 12:00 ` Ian Jackson
2016-08-04 12:03 ` Wei Liu
2016-08-04 8:45 ` [OSSTEST PATCH RFC 11/14] Introduce ts-xtf-run Wei Liu
2016-08-04 12:19 ` Ian Jackson
2016-08-04 14:40 ` Wei Liu [this message]
2016-08-04 15:31 ` Ian Jackson
2016-08-04 8:45 ` [OSSTEST PATCH RFC 12/14] sg-run-job: test-xtf recipe Wei Liu
2016-08-04 12:20 ` Ian Jackson
2016-08-04 8:45 ` [OSSTEST PATCH RFC 13/14] make-flight: create 5 xtf jobs Wei Liu
2016-08-04 12:24 ` Ian Jackson
2016-08-04 8:46 ` [OSSTEST PATCH RFC 14/14] Create XTF branch Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160804144037.GM32096@citrix.com \
--to=wei.liu2@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.