public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] testcase: gethostid: Check if hostid is available
@ 2018-06-15  6:18 =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
  2018-06-19 11:37 ` Jan Stancek
  0 siblings, 1 reply; 2+ messages in thread
From: =?unknown-8bit?q?Myl=C3=A8ne?= Josserand @ 2018-06-15  6:18 UTC (permalink / raw)
  To: ltp

On some embedded systems, hostid may not be installed.
Because of that, the test will fail with:

gethostid01    1  TFAIL  :  gethostid01.c:171: fgets failed

The test should return a TCONF instead.
This commit uses tst_get_path function to check if "hostid"
is available in $PATH. Otherwise, it will return a TCONF.

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
---
 testcases/kernel/syscalls/gethostid/gethostid01.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/syscalls/gethostid/gethostid01.c b/testcases/kernel/syscalls/gethostid/gethostid01.c
index e6b006759..241335af7 100644
--- a/testcases/kernel/syscalls/gethostid/gethostid01.c
+++ b/testcases/kernel/syscalls/gethostid/gethostid01.c
@@ -239,6 +239,10 @@ int main(int ac, char **av)
 
 void setup(void)
 {
+	char path[2048];
+
+	if (tst_get_path("hostid", path, sizeof(path)))
+		tst_brkm(TCONF, NULL, "Couldn't find hostid in $PATH");
 
 	tst_sig(FORK, DEF_HANDLER, cleanup);
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [LTP] [PATCH] testcase: gethostid: Check if hostid is available
  2018-06-15  6:18 [LTP] [PATCH] testcase: gethostid: Check if hostid is available =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
@ 2018-06-19 11:37 ` Jan Stancek
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Stancek @ 2018-06-19 11:37 UTC (permalink / raw)
  To: ltp


----- Original Message -----
> On some embedded systems, hostid may not be installed.
> Because of that, the test will fail with:
> 
> gethostid01    1  TFAIL  :  gethostid01.c:171: fgets failed
> 
> The test should return a TCONF instead.
> This commit uses tst_get_path function to check if "hostid"
> is available in $PATH. Otherwise, it will return a TCONF.
> 
> Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>

Pushed.

Thanks,
Jan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-19 11:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-15  6:18 [LTP] [PATCH] testcase: gethostid: Check if hostid is available =?unknown-8bit?q?Myl=C3=A8ne?= Josserand
2018-06-19 11:37 ` Jan Stancek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox