build: test on more platforms via QEMU in CI
This commit runs the test suite via QEMU on GitHub Actions on a variety of platforms. Fixes: https://github.com/libuv/libuv/issues/2842 PR-URL: https://github.com/libuv/libuv/pull/2846 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
fcedadcacb
commit
1c976110d5
54
.github/workflows/CI.yml
vendored
Normal file
54
.github/workflows/CI.yml
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-cross-qemu:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: build-cross-qemu-${{ matrix.config.target }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
config:
|
||||||
|
- {target: arm, toolchain: gcc-arm-linux-gnueabi, cc: arm-linux-gnueabi-gcc, qemu: qemu-arm-static }
|
||||||
|
- {target: armhf, toolchain: gcc-arm-linux-gnueabihf, cc: arm-linux-gnueabihf-gcc, qemu: qemu-arm-static }
|
||||||
|
- {target: aarch64, toolchain: gcc-aarch64-linux-gnu, cc: aarch64-linux-gnu-gcc, qemu: qemu-aarch64-static }
|
||||||
|
- {target: riscv64, toolchain: gcc-riscv64-linux-gnu, cc: riscv64-linux-gnu-gcc, qemu: qemu-riscv64-static }
|
||||||
|
- {target: ppc, toolchain: gcc-powerpc-linux-gnu, cc: powerpc-linux-gnu-gcc, qemu: qemu-ppc-static }
|
||||||
|
- {target: ppc64, toolchain: gcc-powerpc64-linux-gnu, cc: powerpc64-linux-gnu-gcc, qemu: qemu-ppc64-static }
|
||||||
|
- {target: ppc64le, toolchain: gcc-powerpc64le-linux-gnu, cc: powerpc64le-linux-gnu-gcc, qemu: qemu-ppc64le-static }
|
||||||
|
- {target: s390x, toolchain: gcc-s390x-linux-gnu, cc: s390x-linux-gnu-gcc, qemu: qemu-s390x-static }
|
||||||
|
- {target: mips, toolchain: gcc-mips-linux-gnu, cc: mips-linux-gnu-gcc, qemu: qemu-mips-static }
|
||||||
|
- {target: mips64, toolchain: gcc-mips64-linux-gnuabi64, cc: mips64-linux-gnuabi64-gcc, qemu: qemu-mips64-static }
|
||||||
|
- {target: mipsel, toolchain: gcc-mipsel-linux-gnu, cc: mipsel-linux-gnu-gcc, qemu: qemu-mipsel-static }
|
||||||
|
- {target: mips64el,toolchain: gcc-mips64el-linux-gnuabi64, cc: mips64el-linux-gnuabi64-gcc,qemu: qemu-mips64el-static }
|
||||||
|
- {target: alpha, toolchain: gcc-alpha-linux-gnu, cc: alpha-linux-gnu-gcc, qemu: qemu-alpha-static }
|
||||||
|
- {target: arm (u64 slots), toolchain: gcc-arm-linux-gnueabi, cc: arm-linux-gnueabi-gcc, qemu: qemu-arm-static}
|
||||||
|
- {target: aarch64 (u64 slots), toolchain: gcc-aarch64-linux-gnu, cc: aarch64-linux-gnu-gcc, qemu: qemu-aarch64-static}
|
||||||
|
- {target: ppc (u64 slots), toolchain: gcc-powerpc-linux-gnu, cc: powerpc-linux-gnu-gcc, qemu: qemu-ppc-static}
|
||||||
|
- {target: ppc64 (u64 slots), toolchain: gcc-powerpc64-linux-gnu, cc: powerpc64-linux-gnu-gcc, qemu: qemu-ppc64-static}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Install QEMU
|
||||||
|
# this ensure install latest qemu on ubuntu, apt get version is old
|
||||||
|
env:
|
||||||
|
QEMU_SRC: "http://archive.ubuntu.com/ubuntu/pool/universe/q/qemu"
|
||||||
|
QEMU_VER: "qemu-user-static_4\\.2-.*_amd64.deb$"
|
||||||
|
run: |
|
||||||
|
DEB=`curl -s $QEMU_SRC/ | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2 | grep $QEMU_VER`
|
||||||
|
wget $QEMU_SRC/$DEB
|
||||||
|
sudo dpkg -i $DEB
|
||||||
|
- name: Install ${{ matrix.config.toolchain }}
|
||||||
|
run: |
|
||||||
|
sudo apt install ${{ matrix.config.toolchain }} -y
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
mkdir build
|
||||||
|
cd build && cmake .. -DBUILD_TESTING=ON -DQEMU=ON -DCMAKE_C_COMPILER=${{ matrix.config.cc }}
|
||||||
|
cmake --build .
|
||||||
|
ls -lh
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
${{ matrix.config.qemu }} build/uv_run_tests_a
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -67,6 +67,7 @@ ipch
|
|||||||
|
|
||||||
# Clion / IntelliJ project files
|
# Clion / IntelliJ project files
|
||||||
/.idea/
|
/.idea/
|
||||||
|
cmake-build-debug/
|
||||||
|
|
||||||
*.xcodeproj
|
*.xcodeproj
|
||||||
*.xcworkspace
|
*.xcworkspace
|
||||||
|
|||||||
@ -24,6 +24,12 @@ cmake_dependent_option(LIBUV_BUILD_BENCH
|
|||||||
"Build the benchmarks when building unit tests and we are the root project" ON
|
"Build the benchmarks when building unit tests and we are the root project" ON
|
||||||
"LIBUV_BUILD_TESTS" OFF)
|
"LIBUV_BUILD_TESTS" OFF)
|
||||||
|
|
||||||
|
# Qemu Build
|
||||||
|
option(QEMU "build for qemu" OFF)
|
||||||
|
if(QEMU)
|
||||||
|
add_definitions(-D__QEMU__=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Compiler check
|
# Compiler check
|
||||||
string(CONCAT is-msvc $<OR:
|
string(CONCAT is-msvc $<OR:
|
||||||
$<C_COMPILER_ID:MSVC>,
|
$<C_COMPILER_ID:MSVC>,
|
||||||
@ -525,7 +531,11 @@ if(LIBUV_BUILD_TESTS)
|
|||||||
add_executable(uv_run_tests_a ${uv_test_sources} uv_win_longpath.manifest)
|
add_executable(uv_run_tests_a ${uv_test_sources} uv_win_longpath.manifest)
|
||||||
target_compile_definitions(uv_run_tests_a PRIVATE ${uv_defines})
|
target_compile_definitions(uv_run_tests_a PRIVATE ${uv_defines})
|
||||||
target_compile_options(uv_run_tests_a PRIVATE ${uv_cflags})
|
target_compile_options(uv_run_tests_a PRIVATE ${uv_cflags})
|
||||||
|
if(QEMU)
|
||||||
|
target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries} -static)
|
||||||
|
else()
|
||||||
target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries})
|
target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries})
|
||||||
|
endif()
|
||||||
add_test(NAME uv_test_a
|
add_test(NAME uv_test_a
|
||||||
COMMAND uv_run_tests_a
|
COMMAND uv_run_tests_a
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
@ -565,3 +575,11 @@ if(WIN32)
|
|||||||
RUNTIME DESTINATION lib/$<CONFIG>
|
RUNTIME DESTINATION lib/$<CONFIG>
|
||||||
ARCHIVE DESTINATION lib/$<CONFIG>)
|
ARCHIVE DESTINATION lib/$<CONFIG>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "summary of build options:
|
||||||
|
Install prefix: ${CMAKE_INSTALL_PREFIX}
|
||||||
|
Target system: ${CMAKE_SYSTEM_NAME}
|
||||||
|
Compiler:
|
||||||
|
C compiler: ${CMAKE_C_COMPILER}
|
||||||
|
CFLAGS: ${CMAKE_C_FLAGS_${_build_type}} ${CMAKE_C_FLAGS}
|
||||||
|
")
|
||||||
|
|||||||
@ -120,6 +120,11 @@ static void connection_fail(uv_connect_cb connect_cb) {
|
|||||||
* expect an error.
|
* expect an error.
|
||||||
*/
|
*/
|
||||||
TEST_IMPL(connection_fail) {
|
TEST_IMPL(connection_fail) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
|
|
||||||
connection_fail(on_connect_with_close);
|
connection_fail(on_connect_with_close);
|
||||||
|
|
||||||
ASSERT(timer_close_cb_calls == 0);
|
ASSERT(timer_close_cb_calls == 0);
|
||||||
@ -136,6 +141,11 @@ TEST_IMPL(connection_fail) {
|
|||||||
* attempt.
|
* attempt.
|
||||||
*/
|
*/
|
||||||
TEST_IMPL(connection_fail_doesnt_auto_close) {
|
TEST_IMPL(connection_fail_doesnt_auto_close) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = uv_timer_init(uv_default_loop(), &timer);
|
r = uv_timer_init(uv_default_loop(), &timer);
|
||||||
|
|||||||
@ -31,6 +31,11 @@
|
|||||||
extern char executable_path[];
|
extern char executable_path[];
|
||||||
|
|
||||||
TEST_IMPL(get_currentexe) {
|
TEST_IMPL(get_currentexe) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
|
|
||||||
char buffer[PATHMAX];
|
char buffer[PATHMAX];
|
||||||
char path[PATHMAX];
|
char path[PATHMAX];
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|||||||
@ -24,6 +24,11 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
TEST_IMPL(get_passwd) {
|
TEST_IMPL(get_passwd) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
|
|
||||||
uv_passwd_t pwd;
|
uv_passwd_t pwd;
|
||||||
size_t len;
|
size_t len;
|
||||||
int r;
|
int r;
|
||||||
|
|||||||
@ -106,6 +106,10 @@ TEST_IMPL(getaddrinfo_fail) {
|
|||||||
|
|
||||||
|
|
||||||
TEST_IMPL(getaddrinfo_fail_sync) {
|
TEST_IMPL(getaddrinfo_fail_sync) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
uv_getaddrinfo_t req;
|
uv_getaddrinfo_t req;
|
||||||
|
|
||||||
/* Use a FQDN by ending in a period */
|
/* Use a FQDN by ending in a period */
|
||||||
@ -144,6 +148,10 @@ TEST_IMPL(getaddrinfo_basic) {
|
|||||||
|
|
||||||
|
|
||||||
TEST_IMPL(getaddrinfo_basic_sync) {
|
TEST_IMPL(getaddrinfo_basic_sync) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
uv_getaddrinfo_t req;
|
uv_getaddrinfo_t req;
|
||||||
|
|
||||||
ASSERT(0 == uv_getaddrinfo(uv_default_loop(),
|
ASSERT(0 == uv_getaddrinfo(uv_default_loop(),
|
||||||
|
|||||||
@ -66,6 +66,11 @@ TEST_IMPL(getnameinfo_basic_ip4) {
|
|||||||
|
|
||||||
|
|
||||||
TEST_IMPL(getnameinfo_basic_ip4_sync) {
|
TEST_IMPL(getnameinfo_basic_ip4_sync) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
|
|
||||||
ASSERT(0 == uv_ip4_addr(address_ip4, port, &addr4));
|
ASSERT(0 == uv_ip4_addr(address_ip4, port, &addr4));
|
||||||
|
|
||||||
ASSERT(0 == uv_getnameinfo(uv_default_loop(),
|
ASSERT(0 == uv_getnameinfo(uv_default_loop(),
|
||||||
|
|||||||
@ -25,6 +25,11 @@
|
|||||||
|
|
||||||
|
|
||||||
TEST_IMPL(platform_output) {
|
TEST_IMPL(platform_output) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
|
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
size_t rss;
|
size_t rss;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|||||||
@ -43,6 +43,11 @@ static void connect_cb(uv_connect_t *req, int status) {
|
|||||||
|
|
||||||
|
|
||||||
TEST_IMPL(tcp_write_after_connect) {
|
TEST_IMPL(tcp_write_after_connect) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
|
|
||||||
struct sockaddr_in sa;
|
struct sockaddr_in sa;
|
||||||
ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &sa));
|
ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &sa));
|
||||||
ASSERT(0 == uv_loop_init(&loop));
|
ASSERT(0 == uv_loop_init(&loop));
|
||||||
|
|||||||
@ -78,6 +78,10 @@ static void getaddrinfo_do(struct getaddrinfo_req* req) {
|
|||||||
static void getaddrinfo_cb(uv_getaddrinfo_t* handle,
|
static void getaddrinfo_cb(uv_getaddrinfo_t* handle,
|
||||||
int status,
|
int status,
|
||||||
struct addrinfo* res) {
|
struct addrinfo* res) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
struct getaddrinfo_req* req;
|
struct getaddrinfo_req* req;
|
||||||
|
|
||||||
ASSERT(status == 0);
|
ASSERT(status == 0);
|
||||||
|
|||||||
@ -54,6 +54,11 @@ static void sv_send_cb(uv_udp_send_t* req, int status) {
|
|||||||
|
|
||||||
|
|
||||||
TEST_IMPL(udp_multicast_interface) {
|
TEST_IMPL(udp_multicast_interface) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
uv_udp_send_t req;
|
uv_udp_send_t req;
|
||||||
uv_buf_t buf;
|
uv_buf_t buf;
|
||||||
|
|||||||
@ -54,6 +54,11 @@ static void sv_send_cb(uv_udp_send_t* req, int status) {
|
|||||||
|
|
||||||
|
|
||||||
TEST_IMPL(udp_multicast_interface6) {
|
TEST_IMPL(udp_multicast_interface6) {
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
uv_udp_send_t req;
|
uv_udp_send_t req;
|
||||||
uv_buf_t buf;
|
uv_buf_t buf;
|
||||||
|
|||||||
@ -193,6 +193,10 @@ TEST_IMPL(udp_multicast_join6) {
|
|||||||
|
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
r = uv_udp_recv_start(&server, alloc_cb, cl_recv_cb);
|
r = uv_udp_recv_start(&server, alloc_cb, cl_recv_cb);
|
||||||
ASSERT(r == 0);
|
ASSERT(r == 0);
|
||||||
|
|
||||||
|
|||||||
@ -128,6 +128,10 @@ TEST_IMPL(udp_no_autobind) {
|
|||||||
ASSERT(UV_EBADF == uv_udp_set_ttl(&h, 1));
|
ASSERT(UV_EBADF == uv_udp_set_ttl(&h, 1));
|
||||||
#endif
|
#endif
|
||||||
ASSERT(UV_EBADF == uv_udp_set_multicast_loop(&h, 1));
|
ASSERT(UV_EBADF == uv_udp_set_multicast_loop(&h, 1));
|
||||||
|
/* TODO(gengjiawen): Fix test on QEMU. */
|
||||||
|
#if defined(__QEMU__)
|
||||||
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
|
#endif
|
||||||
ASSERT(UV_EBADF == uv_udp_set_multicast_interface(&h, "0.0.0.0"));
|
ASSERT(UV_EBADF == uv_udp_set_multicast_interface(&h, "0.0.0.0"));
|
||||||
|
|
||||||
uv_close((uv_handle_t*) &h, NULL);
|
uv_close((uv_handle_t*) &h, NULL);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user