diff mbox series

testcase: gethostid: Check if hostid is available

Message ID 20180615061807.15099-1-mylene.josserand@bootlin.com
State Accepted
Delegated to: Petr Vorel
Headers show
Series testcase: gethostid: Check if hostid is available | expand

Commit Message

Mylène Josserand June 15, 2018, 6:18 a.m. UTC
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(+)

Comments

Jan Stancek June 19, 2018, 11:37 a.m. UTC | #1
----- 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
diff mbox series

Patch

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);