public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: chrubis@suse.cz
To: alexey.kodanev@oracle.com
Cc: vasily.isaenko@oracle.com, ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v4 2/2] device-drivers: acpi: fixes
Date: Thu, 28 Nov 2013 12:39:28 +0100	[thread overview]
Message-ID: <20131128113928.GC19263@rei.Home> (raw)
In-Reply-To: <529725F3.6040002@oracle.com>

Hi!
> >> +	while (i < TST_TOTAL) {
> >> +
> >> +		SAFE_FILE_PRINTF(cleanup, dev_tcase, "%d", i);
> >> +		SAFE_FILE_SCANF(cleanup, dev_result, "%d", &res);
> >> +
> >> +		tst_resm(res, "Test-case '%d'", i);
> >> +
> >> +		/*
> >> +		 * trigger ACPI_TRAVERSE test-case while we can
> >> +		 * get valid next device description.
> >> +		 */
> >> +		if (i == ACPI_TRAVERSE && next_acpi_str())
> >> +			continue;
> > The same goes for the tst_resm() here.
> >
> > I would write this part so that reading the sys_str file triggers
> > walking to next object with _STR argument, while writing to dev_tcase
> > will reset the walk to root and wrote a code as:
> >
> > 	SAFE_FILE_PRINTF(cleanup, dev_tcase, "%d", i);
> > 	SAFE_FILE_SCANF(cleanup, dev_result, "%d", &res);
> >
> > 	if (i == ACPI_TRAVERSE)
> > 		res = next_acpi_str();
> >
> > 	tst_resm(...);
> >
> > And the next_acpi_str() would loop on reading the dev_str while "null"
> > is returned. Or even better make the read returns zero size at the end,
> > (should be mapped to EOF in case of FILE*).
> OK
> > Also I would be more carefull and rather sanitized the result value, i.e.
> >
> > 	tst_resm(ret ? TFAIL : TPASS, "...");
> If I do that way, next_acpi_str could also return TCONF (kernel version 
> lower than 3.7) and then we would get TFAIL in the test-case result.

Ah, hmm, so what about:


	SAFE_FILE_PRINTF(cleanup, dev_tcase, "%d", i);
	SAFE_FILE_SCANF(cleanup, dev_result, "%d", &res);

	res = res ? TFAIL : TPASS;

	if (i == ACPI_TRAVERSE)
		res = next_acpi_str();

	...


-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2013-11-28 11:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18 14:18 [LTP] [PATCH 1/2] device-drivers: acpi: fix file names Alexey Kodanev
2013-11-18 14:18 ` [LTP] [PATCH v4 2/2] device-drivers: acpi: fixes Alexey Kodanev
2013-11-27 18:04   ` chrubis
     [not found]     ` <529725F3.6040002@oracle.com>
2013-11-28 11:39       ` chrubis [this message]
     [not found]         ` <52972F1C.3020504@oracle.com>
2013-11-28 12:09           ` chrubis

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=20131128113928.GC19263@rei.Home \
    --to=chrubis@suse.cz \
    --cc=alexey.kodanev@oracle.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=vasily.isaenko@oracle.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox