build: enable fdsan in Android
This patch will update Android API in CI to 29 and will set up the fdsan in the test runner. Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> Fixes: https://github.com/libuv/libuv/issues/4369
This commit is contained in:
parent
3d78d121f4
commit
a94f2ad2b7
8
.github/workflows/CI-unix.yml
vendored
8
.github/workflows/CI-unix.yml
vendored
@ -43,7 +43,7 @@ jobs:
|
|||||||
- name: Build and Test
|
- name: Build and Test
|
||||||
uses: reactivecircus/android-emulator-runner@v2
|
uses: reactivecircus/android-emulator-runner@v2
|
||||||
with:
|
with:
|
||||||
api-level: 24
|
api-level: 30
|
||||||
arch: x86_64
|
arch: x86_64
|
||||||
target: google_apis
|
target: google_apis
|
||||||
ram-size: 2048M
|
ram-size: 2048M
|
||||||
@ -51,7 +51,7 @@ jobs:
|
|||||||
disable-animations: true
|
disable-animations: true
|
||||||
script: |
|
script: |
|
||||||
echo "::group::Configure"
|
echo "::group::Configure"
|
||||||
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-24
|
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="x86_64" -DANDROID_PLATFORM=android-30
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
echo "::group::Build"
|
echo "::group::Build"
|
||||||
@ -60,8 +60,8 @@ jobs:
|
|||||||
## Correct some ld bugs that cause problems with libuv tests
|
## Correct some ld bugs that cause problems with libuv tests
|
||||||
wget "https://github.com/termux/termux-elf-cleaner/releases/download/v2.2.1/termux-elf-cleaner" -P build
|
wget "https://github.com/termux/termux-elf-cleaner/releases/download/v2.2.1/termux-elf-cleaner" -P build
|
||||||
chmod a+x build/termux-elf-cleaner
|
chmod a+x build/termux-elf-cleaner
|
||||||
build/termux-elf-cleaner --api-level 24 ./build/uv_run_tests
|
build/termux-elf-cleaner --api-level 30 ./build/uv_run_tests
|
||||||
build/termux-elf-cleaner --api-level 24 ./build/uv_run_tests_a
|
build/termux-elf-cleaner --api-level 30 ./build/uv_run_tests_a
|
||||||
|
|
||||||
adb shell "su 0 setenforce 0" # to allow some syscalls like link, chmod, etc.
|
adb shell "su 0 setenforce 0" # to allow some syscalls like link, chmod, etc.
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,11 @@
|
|||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include "uv.h"
|
#include "uv.h"
|
||||||
|
|
||||||
|
/* Refs: https://github.com/libuv/libuv/issues/4369 */
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
#include <android/fdsan.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
char executable_path[sizeof(executable_path)];
|
char executable_path[sizeof(executable_path)];
|
||||||
|
|
||||||
|
|
||||||
@ -142,6 +147,13 @@ void log_tap_result(int test_count,
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void enable_fdsan(void) {
|
||||||
|
/* Refs: https://github.com/libuv/libuv/issues/4369 */
|
||||||
|
#if defined(__ANDROID__)
|
||||||
|
android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_WARN_ALWAYS);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int run_test(const char* test,
|
int run_test(const char* test,
|
||||||
int benchmark_output,
|
int benchmark_output,
|
||||||
@ -160,6 +172,8 @@ int run_test(const char* test,
|
|||||||
main_proc = NULL;
|
main_proc = NULL;
|
||||||
process_count = 0;
|
process_count = 0;
|
||||||
|
|
||||||
|
enable_fdsan();
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
/* Clean up stale socket from previous run. */
|
/* Clean up stale socket from previous run. */
|
||||||
remove(TEST_PIPENAME);
|
remove(TEST_PIPENAME);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user