diff --git a/.github/workflows/CI-unix.yml b/.github/workflows/CI-unix.yml index 7d665176..591c35cf 100644 --- a/.github/workflows/CI-unix.yml +++ b/.github/workflows/CI-unix.yml @@ -35,6 +35,7 @@ jobs: # image. env: ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + ANDROID_AVD_HOME: /root/.android/avd steps: - uses: actions/checkout@v3 - name: Envinfo @@ -49,6 +50,31 @@ jobs: 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" + + - name: Start emulator + run: | + echo no | avdmanager create avd -n test -k "system-images;android-24;google_apis;arm64-v8a" + + adb start-server + + 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 wait-for-device + + 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" build-macos: runs-on: macos-12 diff --git a/test/task.h b/test/task.h index 8b835326..e25a9c9a 100644 --- a/test/task.h +++ b/test/task.h @@ -53,6 +53,10 @@ # define TEST_PIPENAME "\\\\.\\pipe\\uv-test" # define TEST_PIPENAME_2 "\\\\.\\pipe\\uv-test2" # define TEST_PIPENAME_3 "\\\\.\\pipe\\uv-test3" +#elif __ANDROID__ +# define TEST_PIPENAME "/data/local/tmp/uv-test-sock" +# define TEST_PIPENAME_2 "/data/local/tmp/uv-test-sock2" +# define TEST_PIPENAME_3 "/data/local/tmp/uv-test-sock3" #else # define TEST_PIPENAME "/tmp/uv-test-sock" # define TEST_PIPENAME_2 "/tmp/uv-test-sock2" diff --git a/test/test-emfile.c b/test/test-emfile.c index ef2338cd..3ad8378c 100644 --- a/test/test-emfile.c +++ b/test/test-emfile.c @@ -75,6 +75,14 @@ TEST_IMPL(emfile) { ASSERT_EQ(errno, EMFILE); close(maxfd); +#if defined(__ANDROID__) + /* Android connect syscall requires an extra file descriptor + * + * It fails in uv__tcp_connect + * */ + close(maxfd - 1); +#endif + /* Now connect and use up the last available file descriptor. The EMFILE * handling logic in src/unix/stream.c should ensure that connect_cb() runs * whereas connection_cb() should *not* run. diff --git a/test/test-udp-multicast-join6.c b/test/test-udp-multicast-join6.c index 11efb0a6..c6872e42 100644 --- a/test/test-udp-multicast-join6.c +++ b/test/test-udp-multicast-join6.c @@ -192,6 +192,11 @@ TEST_IMPL(udp_multicast_join6) { ASSERT_OK(r); +#if defined(__ANDROID__) + /* It returns an ENOSYS error */ + RETURN_SKIP("Test does not currently work in ANDROID"); +#endif + /* TODO(gengjiawen): Fix test on QEMU. */ #if defined(__QEMU__) RETURN_SKIP("Test does not currently work in QEMU");