1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (c) 2018 Linux Test Project
4 * Copyright (C) 2015 Cyril Hrubis chrubis@suse.cz
5 */
6
7#define TST_NO_DEFAULT_MAIN
8#include <stdlib.h>
9#include "tst_test.h"
10
11int main(int argc, char *argv[])
12{
13	char *env;
14
15	tst_reinit();
16
17	if (argc != 2)
18		tst_brk(TFAIL, "argc is %d, expected 2", argc);
19
20	if (strcmp(argv[1], "canary"))
21		tst_brk(TFAIL, "argv[1] is %s, expected 'canary'", argv[1]);
22
23	env = getenv("LTP_TEST_ENV_VAR");
24
25	if (!env)
26		tst_brk(TFAIL, "LTP_TEST_ENV_VAR is missing");
27
28	if (strcmp(env, "test"))
29		tst_brk(TFAIL, "LTP_TEST_ENV_VAR='%s', expected test", env);
30
31	if (getenv("PATH"))
32		tst_brk(TFAIL, "PATH is in environment");
33
34	tst_res(TPASS, "%s executed", argv[0]);
35
36	return 0;
37}
38