c8d07815 | 03-Aug-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: avoid unused parameter warnings
This warning will be enabled later so avoid triggering it.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1
selftests/nolibc: avoid unused parameter warnings
This warning will be enabled later so avoid triggering it.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
17e66f23 | 03-Aug-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: make functions static if possible
This allows the compiler to generate warnings if they go unused.
Functions that are supposed to be used as breakpoints should not be static, so u
selftests/nolibc: make functions static if possible
This allows the compiler to generate warnings if they go unused.
Functions that are supposed to be used as breakpoints should not be static, so un-statify those if necessary.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
10874f20 | 03-Aug-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: mark test helpers as potentially unused
When warning about unused functions these would be reported by we want to keep them for future use.
Suggested-by: Zhangjin Wu <falcon@tinyl
selftests/nolibc: mark test helpers as potentially unused
When warning about unused functions these would be reported by we want to keep them for future use.
Suggested-by: Zhangjin Wu <falcon@tinylab.org> Link: https://lore.kernel.org/lkml/20230731064826.16584-1-falcon@tinylab.org/ Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/lkml/20230731224929.GA18296@1wt.eu/ Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
79df81aa | 03-Aug-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: drop unused variables
These got copied around as new testcases where created.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu> |
ca283457 | 06-Aug-2023 |
Willy Tarreau <w@1wt.eu> |
selftests/nolibc: avoid warnings during intptr tests
Recent fix ceb528feb7c8 ("selftests/nolibc: avoid gaps in test numbers") had the annoying side effect of always returning skipped tests, which ar
selftests/nolibc: avoid warnings during intptr tests
Recent fix ceb528feb7c8 ("selftests/nolibc: avoid gaps in test numbers") had the annoying side effect of always returning skipped tests, which are normally supposed to happen only when certain features are missing to run the test (missing kernel options, toolchain not supporting stack-protector etc). As such there are now always warnings. Let's modify the test to not use the condition and instead use a ternary expression to check the result.
Fixes: ceb528feb7c8 ("selftests/nolibc: avoid gaps in test numbers") Cc: Thomas WeiÃ<9F>schuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
64077502 | 03-Aug-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: fix return type of getpagesize()
It's documented as returning int which is also implemented by glibc and musl, so adopt that return type.
Signed-off-by: Thomas Weißschuh <linux@weisss
tools/nolibc: fix return type of getpagesize()
It's documented as returning int which is also implemented by glibc and musl, so adopt that return type.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
5c01259b | 01-Aug-2023 |
Yuan Tan <tanyuan@tinylab.org> |
selftests/nolibc: add testcase for pipe
Add a test case of pipe that sends and receives message in a single process.
Suggested-by: Thomas Weißschuh <thomas@t-8ch.de> Suggested-by: Willy Tarreau <w@
selftests/nolibc: add testcase for pipe
Add a test case of pipe that sends and receives message in a single process.
Suggested-by: Thomas Weißschuh <thomas@t-8ch.de> Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/all/c5de2d13-3752-4e1b-90d9-f58cca99c702@t-8ch.de/ Signed-off-by: Yuan Tan <tanyuan@tinylab.org> Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> [wt: fixed the "len" type to size_t to address a sign-compare warning with upcoming patches] Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
e7d0129d | 25-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: mmap_munmap_good: fix up return value
The other tests use 1 as failure, mmap_munmap_good uses -1 as failure, let's fix up this.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Rev
selftests/nolibc: mmap_munmap_good: fix up return value
The other tests use 1 as failure, mmap_munmap_good uses -1 as failure, let's fix up this.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
447e5602 | 26-Jul-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: avoid buffer underrun in space printing
If the test description is longer than the status alignment the parameter 'n' to putcharn() would lead to a signed underflow that then gets
selftests/nolibc: avoid buffer underrun in space printing
If the test description is longer than the status alignment the parameter 'n' to putcharn() would lead to a signed underflow that then gets converted to a very large unsigned value. This in turn leads out-of-bound writes in memset() crashing the application.
The failure case of EXPECT_PTRER() used in "mmap_bad" exhibits this exact behavior.
Fixes: 29f5540be392 ("selftests/nolibc: add EXPECT_PTREQ, EXPECT_PTRNE and EXPECT_PTRER") Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
850fad7d | 15-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: allow test -include /path/to/nolibc.h
As the head comment of nolibc-test.c shows, it can be built in 3 ways:
$(CC) -nostdlib -include /path/to/nolibc.h => NOLIBC already defin
selftests/nolibc: allow test -include /path/to/nolibc.h
As the head comment of nolibc-test.c shows, it can be built in 3 ways:
$(CC) -nostdlib -include /path/to/nolibc.h => NOLIBC already defined $(CC) -nostdlib -I/path/to/nolibc/sysroot => _NOLIBC_* guards are present $(CC) with default libc => NOLIBC* never defined
Only last two of them are tested currently, let's allow test the first one too.
This may help to find issues about using nolibc.h to build programs. it derives from this change:
commit 3a8039e289a3 ("tools/nolibc: Fix build of stdio.h due to header ordering")
Usage:
// test with sysroot by default $ make run-user
// test without sysroot, using nolibc.h directly $ make run-user NOLIBC_SYSROOT=0
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
b8143407 | 15-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: allow run nolibc-test locally
It is able to run nolibc-test directly without qemu-user when the target machine is the same as the host machine.
Sometimes, the result running local
selftests/nolibc: allow run nolibc-test locally
It is able to run nolibc-test directly without qemu-user when the target machine is the same as the host machine.
Sometimes, the result running locally may help a lot when the qemu-user package is too old.
When the target machine differs from the host machine, it is also able to run nolibc-test directly with qemu-user-static + binfmt_misc.
Link: https://lore.kernel.org/lkml/ZKutZwIOfy5MqedG@1wt.eu/ Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
48967b73 | 15-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: add testcases for startup code
The startup code is critical to get the right argc, argv, envp/environ and _auxv, let's add a startup test group and the corresponding testcases.
Th
selftests/nolibc: add testcases for startup code
The startup code is critical to get the right argc, argv, envp/environ and _auxv, let's add a startup test group and the corresponding testcases.
The "environ" test case is also moved from the stdlib test group to this new startup test group and it is renamed to "environ_envp".
Since argv0 has been used by many other test cases, let's add testcases to gurantee it too.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
fd3a9efd | 15-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: add EXPECT_PTRGE, EXPECT_PTRGT, EXPECT_PTRLE, EXPECT_PTRLT
4 new pointer compare macros are added, they are similar to the integer compare macros.
Signed-off-by: Zhangjin Wu <falc
selftests/nolibc: add EXPECT_PTRGE, EXPECT_PTRGT, EXPECT_PTRLE, EXPECT_PTRLT
4 new pointer compare macros are added, they are similar to the integer compare macros.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
ceb528fe | 11-Jul-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: avoid gaps in test numbers
As the test numbers are based on line numbers gaps without testcases are to be avoided. Instead use the already existing test condition logic to implemen
selftests/nolibc: avoid gaps in test numbers
As the test numbers are based on line numbers gaps without testcases are to be avoided. Instead use the already existing test condition logic to implement conditional execution.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
b184a261 | 11-Jul-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: simplify status printing
pad_spc() is only ever used to print the status message of testcases. The line size is always constant, the return value is never used and the format strin
selftests/nolibc: simplify status printing
pad_spc() is only ever used to print the status message of testcases. The line size is always constant, the return value is never used and the format string is never used as such.
Remove all the unneeded logic and simplify the API and its users.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
3097783e | 11-Jul-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
selftests/nolibc: make evaluation of test conditions
If "cond" is a multi-token statement the behavior of the preprocessor will lead to the negation "!" to be only applied to the first token. Althou
selftests/nolibc: make evaluation of test conditions
If "cond" is a multi-token statement the behavior of the preprocessor will lead to the negation "!" to be only applied to the first token. Although currently no test uses such multi-token conditions but it can happen at any time.
Put braces around "cond" to ensure the negation works as expected.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
67d108e2 | 10-Jul-2023 |
Thomas Weißschuh <linux@weissschuh.net> |
tools/nolibc: completely remove optional environ support
In commit 52e423f5b93e ("tools/nolibc: export environ as a weak symbol on i386") and friends the asm startup logic was extended to directly p
tools/nolibc: completely remove optional environ support
In commit 52e423f5b93e ("tools/nolibc: export environ as a weak symbol on i386") and friends the asm startup logic was extended to directly populate the "environ" array.
This makes it impossible for "environ" to be dropped by the linker. Therefore also drop the other logic to handle non-present "environ".
Also add a testcase to validate the initialization of environ.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
4beb9be8 | 06-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: report: add newline before test failures
a newline is inserted just before the test failures to avoid mixing the test failures with the raw test log.
Signed-off-by: Zhangjin Wu <f
selftests/nolibc: report: add newline before test failures
a newline is inserted just before the test failures to avoid mixing the test failures with the raw test log.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
7d92e893 | 06-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: report: extrude the test status line
two newlines are added around the test summary line to extrude the test status.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by:
selftests/nolibc: report: extrude the test status line
two newlines are added around the test summary line to extrude the test status.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
0ac908e3 | 06-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: report: align passed, skipped and failed
align the test values for different runs and different architectures.
Since the total number of tests is not bigger than 1000 currently, l
selftests/nolibc: report: align passed, skipped and failed
align the test values for different runs and different architectures.
Since the total number of tests is not bigger than 1000 currently, let's align them with "%3d".
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> [wt: s/%03d/%3d/ as discussed with Zhangjin] Link: https://lore.kernel.org/lkml/20230709185112.97236-1-falcon@tinylab.org/ Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
c0faa0da | 06-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: report: print total tests
Let's count and print the total number of tests, now, the data of passed, skipped and failed have the same format.
Signed-off-by: Zhangjin Wu <falcon@tin
selftests/nolibc: report: print total tests
Let's count and print the total number of tests, now, the data of passed, skipped and failed have the same format.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
c0315c79 | 06-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: report: print a summarized test status
one of the test status: success, warning and failure is printed to summarize the passed, skipped and failed values.
- "success" means no ski
selftests/nolibc: report: print a summarized test status
one of the test status: success, warning and failure is printed to summarize the passed, skipped and failed values.
- "success" means no skipped and no failed. - "warning" means has at least one skipped and no failed. - "failure" means all tests are failed.
Suggested-by: Willy Tarreau <w@1wt.eu> Link: https://lore.kernel.org/lkml/20230702164358.GB16233@1wt.eu/ Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
148e9718 | 07-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: add chmod_argv0 test
argv0 is readable and chmodable, let's use it for chmod test, but a safe umask should be used, the readable and executable modes should be reserved.
Reviewed-
selftests/nolibc: add chmod_argv0 test
argv0 is readable and chmodable, let's use it for chmod test, but a safe umask should be used, the readable and executable modes should be reserved.
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
135b622e | 07-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: chroot_exe: remove procfs dependency
Since argv0 also works for CONFIG_PROC_FS=n, let's use it instead of '/proc/self/exe'.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-
selftests/nolibc: chroot_exe: remove procfs dependency
Since argv0 also works for CONFIG_PROC_FS=n, let's use it instead of '/proc/self/exe'.
Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|
f576d3c0 | 07-Jul-2023 |
Zhangjin Wu <falcon@tinylab.org> |
selftests/nolibc: stat_timestamps: remove procfs dependency
'/proc/self/' is a good path which doesn't have stale time info but it is only available for CONFIG_PROC_FS=y.
When CONFIG_PROC_FS=n, use
selftests/nolibc: stat_timestamps: remove procfs dependency
'/proc/self/' is a good path which doesn't have stale time info but it is only available for CONFIG_PROC_FS=y.
When CONFIG_PROC_FS=n, use argv0 instead of '/proc/self', use '/' for the worst case.
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
show more ...
|