Commit 938b5b98 authored by Zhangjin Wu's avatar Zhangjin Wu Committed by Willy Tarreau

selftests/nolibc: export argv0 for some tests

argv0 is the path to nolibc-test program itself, which is a very good
always existing readable file for some tests, let's export it.

Note, the path may be absolute or relative, please make sure the tests
work with both of them. If it is relative, we must make sure the current
path is the one specified by the PWD environment variable.
Suggested-by: default avatarWilly Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/lkml/ZKKbS3cwKcHgnGwu@1wt.eu/Signed-off-by: default avatarZhangjin Wu <falcon@tinylab.org>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent 4201cfce
......@@ -43,6 +43,9 @@
/* will be used by nolibc by getenv() */
char **environ;
/* will be used by some test cases as readable file, please don't write it */
static const char *argv0;
/* definition of a series of tests */
struct test {
const char *name; /* test name */
......@@ -948,6 +951,7 @@ int main(int argc, char **argv, char **envp)
int idx;
char *test;
argv0 = argv[0];
environ = envp;
/* when called as init, it's possible that no console was opened, for
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment