diff --git a/.github/workflows/CI-unix.yml b/.github/workflows/CI-unix.yml index 26f1e0e4..118e5446 100644 --- a/.github/workflows/CI-unix.yml +++ b/.github/workflows/CI-unix.yml @@ -29,52 +29,51 @@ jobs: build-android: runs-on: ubuntu-latest - container: reactnativecommunity/react-native-android:2020-5-20 - # Work around an issue where the node from actions/checkout is too new - # to run inside the long-in-the-tooth react-nactive-android container - # image. env: - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true ANDROID_AVD_HOME: /root/.android/avd steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Envinfo run: npx envinfo - - name: Configure android arm64 - # see build options you can use in https://developer.android.com/ndk/guides/cmake + - name: Enable KVM run: | - mkdir build - cd build - $ANDROID_HOME/cmake/3.10.2.4988404/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/20.0.5594570/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-24 .. - - name: Build android arm64 - run: | - $ANDROID_HOME/cmake/3.10.2.4988404/bin/cmake --build build - ls -lh build - - name: Install Android ABI arm64-v8a - run: | - # TODO: This can be in a pre-built docker image - sdkmanager "build-tools;24.0.3" "platforms;android-24" "system-images;android-24;google_apis;arm64-v8a" + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + - name: Build and Test + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 24 + arch: x86_64 + target: google_apis + ram-size: 2048M + emulator-options: -no-audio -no-window -gpu off -no-boot-anim -netdelay none -netspeed full -writable-system -no-snapshot-save -no-snapshot-load -no-snapshot + disable-animations: true + script: | + 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 + echo "::endgroup::" - - name: Start emulator - run: | - echo no | avdmanager create avd -n test -k "system-images;android-24;google_apis;arm64-v8a" + echo "::group::Build" + cmake --build build - adb start-server + ## 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 + chmod a+x build/termux-elf-cleaner + build/termux-elf-cleaner --api-level 24 ./build/uv_run_tests + build/termux-elf-cleaner --api-level 24 ./build/uv_run_tests_a - emulator @test -memory 2048 -no-audio -no-window -gpu off -no-snapshot -no-boot-anim -netdelay none -netspeed full -no-snapshot-save -no-snapshot-load -writable-system & + adb shell "su 0 setenforce 0" # to allow some syscalls like link, chmod, etc. - adb wait-for-device + ## Push the build and test fixtures to the device + adb push build /data/local/tmp + adb shell mkdir /data/local/tmp/build/test + adb push test/fixtures /data/local/tmp/build/test + echo "::endgroup::" - adb shell "su 0 setenforce 0" # to allow some syscalls like link, chmod, etc. - - # Push the build and test fixtures to the device - adb push build /data/local/tmp - adb shell mkdir /data/local/tmp/build/test - adb push test/fixtures /data/local/tmp/build/test - - - name: Test - run: | - adb shell "cd /data/local/tmp/build ; env UV_TEST_TIMEOUT_MULTIPLIER=5 ./uv_run_tests_a" + ## Run the tests + file build/uv_run_tests_a + adb shell "cd /data/local/tmp/build && env UV_TEST_TIMEOUT_MULTIPLIER=5 ./uv_run_tests_a" build-macos: runs-on: ${{ matrix.os }} diff --git a/test/test-idna.c b/test/test-idna.c index 4a165573..46df9f3c 100644 --- a/test/test-idna.c +++ b/test/test-idna.c @@ -39,7 +39,7 @@ TEST_IMPL(utf8_decode1) { /* Two-byte sequences. */ p = b; - snprintf(b, sizeof(b), "\xC2\x80\xDF\xBF"); + snprintf(b, sizeof(b), "%s", "\xC2\x80\xDF\xBF"); ASSERT_EQ(128, uv__utf8_decode1(&p, b + sizeof(b))); ASSERT_PTR_EQ(p, b + 2); ASSERT_EQ(0x7FF, uv__utf8_decode1(&p, b + sizeof(b))); @@ -47,7 +47,7 @@ TEST_IMPL(utf8_decode1) { /* Three-byte sequences. */ p = b; - snprintf(b, sizeof(b), "\xE0\xA0\x80\xEF\xBF\xBF"); + snprintf(b, sizeof(b), "%s", "\xE0\xA0\x80\xEF\xBF\xBF"); ASSERT_EQ(0x800, uv__utf8_decode1(&p, b + sizeof(b))); ASSERT_PTR_EQ(p, b + 3); ASSERT_EQ(0xFFFF, uv__utf8_decode1(&p, b + sizeof(b))); @@ -55,7 +55,7 @@ TEST_IMPL(utf8_decode1) { /* Four-byte sequences. */ p = b; - snprintf(b, sizeof(b), "\xF0\x90\x80\x80\xF4\x8F\xBF\xBF"); + snprintf(b, sizeof(b), "%s", "\xF0\x90\x80\x80\xF4\x8F\xBF\xBF"); ASSERT_EQ(0x10000, uv__utf8_decode1(&p, b + sizeof(b))); ASSERT_PTR_EQ(p, b + 4); ASSERT_EQ(0x10FFFF, uv__utf8_decode1(&p, b + sizeof(b))); @@ -63,7 +63,7 @@ TEST_IMPL(utf8_decode1) { /* Four-byte sequences > U+10FFFF; disallowed. */ p = b; - snprintf(b, sizeof(b), "\xF4\x90\xC0\xC0\xF7\xBF\xBF\xBF"); + snprintf(b, sizeof(b), "%s", "\xF4\x90\xC0\xC0\xF7\xBF\xBF\xBF"); ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + sizeof(b))); ASSERT_PTR_EQ(p, b + 4); ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + sizeof(b))); @@ -71,7 +71,7 @@ TEST_IMPL(utf8_decode1) { /* Overlong; disallowed. */ p = b; - snprintf(b, sizeof(b), "\xC0\x80\xC1\x80"); + snprintf(b, sizeof(b), "%s", "\xC0\x80\xC1\x80"); ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + sizeof(b))); ASSERT_PTR_EQ(p, b + 2); ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + sizeof(b))); @@ -79,7 +79,7 @@ TEST_IMPL(utf8_decode1) { /* Surrogate pairs; disallowed. */ p = b; - snprintf(b, sizeof(b), "\xED\xA0\x80\xED\xA3\xBF"); + snprintf(b, sizeof(b), "%s", "\xED\xA0\x80\xED\xA3\xBF"); ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + sizeof(b))); ASSERT_PTR_EQ(p, b + 3); ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + sizeof(b))); @@ -87,7 +87,7 @@ TEST_IMPL(utf8_decode1) { /* Simply illegal. */ p = b; - snprintf(b, sizeof(b), "\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"); + snprintf(b, sizeof(b), "%s", "\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"); for (i = 1; i <= 8; i++) { ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + sizeof(b))); diff --git a/test/test-udp-multicast-join.c b/test/test-udp-multicast-join.c index 6d3bca5b..58b05556 100644 --- a/test/test-udp-multicast-join.c +++ b/test/test-udp-multicast-join.c @@ -169,6 +169,10 @@ TEST_IMPL(udp_multicast_join) { if (r == UV_ENOEXEC) RETURN_SKIP("No multicast support (likely a firewall issue)."); ASSERT_OK(r); +#if defined(__ANDROID__) + /* It returns an ENOSYS error */ + RETURN_SKIP("Test does not currently work in ANDROID"); +#endif r = uv_udp_recv_start(&server, alloc_cb, cl_recv_cb); ASSERT_OK(r);