Skip to contentSkip to conversation

testcase: gethostid: Check if hostid is available

PATCH New Mylène Josserand 2 participants 2 messages Jun 15, 2018 – Jun 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testcase: gethostid: Check if hostid is available

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.

---
 testcases/kernel/syscalls/gethostid/gethostid01.c | 4 ++++
 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/gethostid/gethostid01.c +4 -0
index e6b006759..241335af7 100644
@@ -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);
 
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 testcase: gethostid: Check if hostid is available

----- Original Message -----

Quoted 10 lines

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.

Pushed.

Thanks,
Jan