Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI tests are broken in musl environments #1236

Open
BradyBonnette opened this issue Jul 26, 2023 · 1 comment
Open

UI tests are broken in musl environments #1236

BradyBonnette opened this issue Jul 26, 2023 · 1 comment
Labels
bug Something isn't working ci Work related to continuous integration test-support

Comments

@BradyBonnette
Copy link
Contributor

See: #1235

This issue is more of a reminder to go back and possibly do a more in-depth analysis of why UI tests do not work in musl environments.

In particular, the UI tests seem to be failing with attempting to dynamically loaded libraries:

running 1 test
   Compiling pgrx-pg-sys v0.10.0-beta.1 (/checkout/pgrx-pg-sys)
error: failed to run custom build command for `pgrx-pg-sys v0.10.0-beta.1 (/checkout/pgrx-pg-sys)`

Caused by:
  process didn't exit successfully: `/checkout/target/tests/trybuild/debug/build/pgrx-pg-sys-6668251dbe05f204/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=PGRX_BUILD_VERBOSE
  cargo:rerun-if-env-changed=PGRX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE
  cargo:rerun-if-env-changed=PGRX_PG_CONFIG_PATH
  cargo:rerun-if-env-changed=PGRX_PG_CONFIG_AS_ENV
  cargo:rerun-if-env-changed=LLVM_CONFIG_PATH
  cargo:rerun-if-env-changed=LIBCLANG_PATH
  cargo:rerun-if-env-changed=LIBCLANG_STATIC_PATH
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_linux_musl
  cargo:rerun-if-env-changed=PGRX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE
  cargo:rerun-if-changed=include
  cargo:rerun-if-changed=cshim
  cargo:rerun-if-changed=/home/rust/.pgrx/config.toml
  cargo:rerun-if-env-changed=PGRX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE
  cargo:rerun-if-env-changed=PGRX_TARGET_INFO_PATH_PG14_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=PGRX_TARGET_INFO_PATH_PG14
  cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER_PG14_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER_PG14
  cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=PGRX_INCLUDEDIR_SERVER
  cargo:rerun-if-env-changed=PGRX_BINDGEN_NO_DETECT_INCLUDES_x86_64-unknown-linux-musl
  cargo:rerun-if-env-changed=PGRX_BINDGEN_NO_DETECT_INCLUDES

  --- stderr
  build_paths=BuildPaths { manifest_dir: "/checkout/pgrx-pg-sys", out_dir: "/checkout/target/tests/trybuild/x86_64-unknown-linux-musl/debug/build/pgrx-pg-sys-976c22b7f866ebfb/out", src_dir: "/checkout/pgrx-pg-sys/src", shim_src: "/checkout/pgrx-pg-sys/cshim", shim_dst: "/checkout/target/tests/trybuild/x86_64-unknown-linux-musl/debug/build/pgrx-pg-sys-976c22b7f866ebfb/out/cshim" }
  Generating bindings for pg14
  thread '<unnamed>' panicked at 'Unable to find libclang: "the `libclang` shared library at /usr/lib/llvm16/lib/libclang.so.16.0.6 could not be opened: Dynamic loading not supported"', /home/rust/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bindgen-0.66.1/lib.rs:604:31
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  thread 'main' panicked at 'thread panicked while generating bindings: Any { .. }', /checkout/pgrx-pg-sys/build.rs:196:41
test ui ... FAILED

Current theory is that the "-Ctarget-feature=-crt-static" rustflags are somehow ignored/replaced when running the UI tests themselves. This was observed in the "Will It Blend" nighty runs when running pgrx tests in a postgresql-alpine container.

@BradyBonnette BradyBonnette added bug Something isn't working test-support ci Work related to continuous integration labels Jul 26, 2023
@workingjubilee
Copy link
Member

Per myself:

Also to clarify for anyone who comes back and rereads this:

The main reason waiving these tests on a musl target is fine is because they don't add anything to rerun in different envs if they cause trouble for us in CI. The tests are fundamentally tests to guarantee attempts to invoke functions in certain ways fail, because we designed our API to prohibit it. We know the Rust toolchain isn't going to have so much platform-specific variance that these work on some targets and not others.

In a certain sense, if the tests themselves fail to compile at all on a specific target environment, uhm... mission accomplished???

We should reenable them someday when musl distros work as smoothly for Rust as glibc distros do, which is a process mostly happening upstream in Rust's compiler/std/libc bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ci Work related to continuous integration test-support
Projects
None yet
Development

No branches or pull requests

2 participants