1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#[cfg(abi4)]
mod lib_abi4;
#[cfg(abi4)]
pub use crate::lib_abi4::*;
#[cfg(abi5)]
mod lib_abi5;
#[cfg(abi5)]
pub use crate::lib_abi5::*;
#[cfg(abi6)]
mod lib_abi6;
#[cfg(abi6)]
pub use crate::lib_abi6::*;
#[cfg(not(any(abi4, abi5, abi6)))]
compile_error!("BUG: libcec abi not detected");
#[cfg(test)]
mod tests {
use crate::CEC_LIB_VERSION_MAJOR;
use std::env;
#[test]
fn test_abi_ci() {
if env::var("CI").is_err() {
return;
}
let expected_abi = env::var("EXPECTED_LIBCEC_VERSION_MAJOR")
.expect("CI needs to specify EXPECTED_LIBCEC_VERSION_MAJOR");
assert_eq!(
CEC_LIB_VERSION_MAJOR,
expected_abi
.parse()
.expect("Invalid EXPECTED_LIBCEC_VERSION_MAJOR: could not parse to number")
);
}
#[cfg(abi4)]
#[test]
fn test_abi4() {
assert_eq!(CEC_LIB_VERSION_MAJOR, 4);
}
#[cfg(abi5)]
#[test]
fn test_abi5() {
assert_eq!(CEC_LIB_VERSION_MAJOR, 5);
}
#[cfg(abi6)]
#[test]
fn test_abi6() {
assert_eq!(CEC_LIB_VERSION_MAJOR, 6);
}
}