From 7664ba29cb1be3950caf2243ce48f160c885e891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20CORTIER?= Date: Tue, 31 Jan 2023 10:46:24 -0500 Subject: [PATCH] ci: fix sspi-ffi test job for Windows On Windows, we rename symbols using a .def file. For that, we emit a cargo instruction. > cargo:rustc-link-arg=/DEF:sspi.def However, when attempting to run unit tests this causes an error. ``` Caused by: could not execute process `` (never executed) Caused by: %1 is not a valid Win32 application. (os error 193) ``` --- .github/workflows/ci.yml | 2 ++ ffi/build.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8f9e364..5ccd9241 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,6 +55,8 @@ jobs: name: Tests [${{ matrix.os }}] [${{ matrix.crate-name }}] runs-on: ${{ matrix.runner }} needs: formatting + env: + SSPI_RS_IS_RUNNING_TESTS: true strategy: fail-fast: true matrix: diff --git a/ffi/build.rs b/ffi/build.rs index 4c729f8a..04dcda71 100644 --- a/ffi/build.rs +++ b/ffi/build.rs @@ -3,8 +3,9 @@ use std::path::PathBuf; fn main() { let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); + let is_running_tests = env::var("SSPI_RS_IS_RUNNING_TESTS").is_ok(); - if target_os == "windows" { + if target_os == "windows" && !is_running_tests { // On Windows, we provide the linker with a .def file to rename exports. // This module definition file is used to rename some symbols // and avoid linkage conflicts with secur32.dll when building the library.