//! Where the fixture library is, copies of it, the scratch directories //! the tests put the copies in, and a second handle on a library the //! loader opened, through which a test reads the fixture's counters. use std::env::consts::{DLL_EXTENSION, DLL_PREFIX, DLL_SUFFIX}; use std::fs; use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicU64, Ordering}; use libloading::Library; /// Tells apart the directories one process makes; nextest runs each test /// in its own process, so the process id tells those apart. static NEXT_DIRECTORY: AtomicU64 = AtomicU64::new(0); /// The fixture library Cargo built beside this test executable. With /// `crate-type = ["cdylib", "rlib"]`, Cargo builds the library before the /// package's own integration tests run. pub(crate) fn fixture_library() -> PathBuf { let exe = std::env::current_exe().expect("the test executable has a path"); let dir = exe.parent().expect("the test executable has a directory"); dir.join(format!("{DLL_PREFIX}harness_test_plugin{DLL_SUFFIX}")) } /// Makes a fresh directory for the test named `label`, at /// `/