You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[`termux-core-tests`](https://github.com/termux/termux-core-package/blob/master/tests/termux-core-tests.in) can be used to run tests for [`termux-core`](https://github.com/termux/termux-core-package) can be tested with and other external Termux packages.
10
+
11
+
To show help, run `"${TERMUX__PREFIX:-$PREFIX}/libexec/installed-tests/termux-core/termux-core-tests" --help`.
12
+
13
+
14
+
15
+
To run all tests, run `"${TERMUX__PREFIX:-$PREFIX}/libexec/installed-tests/termux-core/termux-core-tests" -vv all`. You can optionally run only `unit` or `runtime` tests as well.
16
+
- The `unit` tests test different units/components of libraries and executables.
17
+
- The `runtime` tests test the runtime execution of libraries and executables.
18
+
19
+
20
+
21
+
Two variants of each test binary is compiled.
22
+
- With `fsanitize` enabled with the `-fsanitize=address -fsanitize-recover=address -fno-omit-frame-pointer` flags that contain `-fsanitize` in filename
23
+
- Without `fsanitize` enabled that contain `-nofsanitize` in filename.
24
+
25
+
This is requires because `fsanitize` does not work on all Android versions/architectures properly and may crash with false positives with the `AddressSantizier: SEGV on unknown address` error, like Android `7` (always crashes) and `x86_64` (requires loop to trigger as occasional crash), even for a source file compiled with an empty `main()` function.
26
+
27
+
To enable `AddressSantizier` while running `termux-core-tests`, pass `-f`. To also enable `LeakSanitizer`, pass `-l` as well, but if it is not supported on current device, the `termux-core-tests` will error out with `AddressSantizier: detect_leaks is not supported on this platform`.
28
+
29
+
If you get `CANNOT LINK EXECUTABLE *: library "libclang_rt.asan-aarch64.so" not found`, like on Android `7`, you will need to install the `libcompiler-rt` package to get the `libclang_rt.asan-aarch64.so` dynamic library required for `AddressSantizier` if passing `-f`. Export library file path with `export LD_LIBRARY_PATH="${TERMUX__PREFIX:-$PREFIX}/lib/clang/17/lib/linux"` before running tests.
30
+
31
+
32
+
33
+
By default, `termux-core-tests` also runs tests other external Termux packages/commands to ensure proper functioning of the Termux execution environment. To only run `termux-core` package specific tests, pass `--only-termux-core-tests`. To run tests for specific packages only, pass a regex with `--test-packages-filter=<filter>` option.
34
+
35
+
36
+
37
+
Make sure to grant Termux app `Draw over apps` permission as otherwise `termux-am` tests will fail.
38
+
39
+
---
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
## Help
48
+
49
+
```
50
+
termux-core-tests can be used to run tests for 'termux-core' and
51
+
other external Termux packages.
52
+
53
+
54
+
Usage:
55
+
termux-core-tests [command_options] <command>
56
+
57
+
Available commands:
58
+
unit Run unit tests.
59
+
runtime Run runtime on-device tests.
60
+
all Run all tests.
61
+
62
+
Available command_options:
63
+
[ -h | --help ] Display this help screen.
64
+
[ --version ] Display version.
65
+
[ -q | --quiet ] Set log level to 'OFF'.
66
+
[ -v | -vv | -vvv | -vvvvv ]
67
+
Set log level to 'DEBUG', 'VERBOSE',
68
+
'VVERBOSE' and 'VVVERBOSE'.
69
+
[ -f ] Use fsanitize binaries for AddressSanitizer.
70
+
[ -l ] Detect memory leaks with LeakSanitizer.
71
+
Requires '-f' to be passed.
72
+
[ --no-clean ] Do not clean test files on failure.
73
+
[ --only-termux-core-tests ]
74
+
Only run 'termux-core' package tests.
75
+
[ --test-names-filter=<filter> ]
76
+
Regex to filter which tests to run by
77
+
test name.
78
+
[ --test-packages-filter=<filter> ]
79
+
Regex to filter which tests to run by
80
+
package names. By default tests for
81
+
both 'termux-core' and external Termux
82
+
packages are run.
83
+
[ --tests-path=<path> ] The path to installed-tests directory.
0 commit comments