Mercurial > crates > nonstick
comparison libpam-sys/libpam-sys-test/build.rs @ 114:93d423b65555
Ignore version-specific OpenPAM constants; generate signed ints.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 29 Jun 2025 03:30:51 -0400 |
parents | 178310336596 |
children |
comparison
equal
deleted
inserted
replaced
113:178310336596 | 114:93d423b65555 |
---|---|
1 use bindgen::MacroTypeVariation; | 1 use bindgen::MacroTypeVariation; |
2 use libpam_sys_impls::cfg_pam_impl; | 2 use libpam_sys_impls::cfg_pam_impl; |
3 use quote::{format_ident, ToTokens}; | 3 use quote::{format_ident, ToTokens}; |
4 use std::path::PathBuf; | 4 use std::path::PathBuf; |
5 use std::{env, fs}; | 5 use std::{env, fs}; |
6 use syn::{Ident, Item, ItemConst, Path, Type, TypePath}; | 6 use syn::{Item, ItemConst, Type, TypePath}; |
7 | 7 |
8 fn main() { | 8 fn main() { |
9 generate_const_test(); | 9 generate_const_test(); |
10 } | 10 } |
11 | 11 |
29 "security/pam_types.h".into(), | 29 "security/pam_types.h".into(), |
30 "security/openpam.h".into(), | 30 "security/openpam.h".into(), |
31 "security/pam_appl.h".into(), | 31 "security/pam_appl.h".into(), |
32 "security/pam_constants.h".into(), | 32 "security/pam_constants.h".into(), |
33 ], | 33 ], |
34 ignore_consts: vec!["OPENPAM_VERSION"], | 34 ignore_consts: vec![ |
35 "OPENPAM_VERSION".into(), | |
36 "OPENPAM_RELEASE".into(), | |
37 "PAM_SOEXT".into(), | |
38 ], | |
35 } | 39 } |
36 } | 40 } |
37 | 41 |
38 #[cfg_pam_impl(not(any("LinuxPam", "OpenPam")))] | 42 #[cfg_pam_impl(not(any("LinuxPam", "OpenPam")))] |
39 fn test_config() -> TestConfig { | 43 fn test_config() -> TestConfig { |
47 .merge_extern_blocks(true) | 51 .merge_extern_blocks(true) |
48 .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) | 52 .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) |
49 .blocklist_type(".*") | 53 .blocklist_type(".*") |
50 .blocklist_function(".*") | 54 .blocklist_function(".*") |
51 .allowlist_var(".*") | 55 .allowlist_var(".*") |
52 .default_macro_constant_type(MacroTypeVariation::Unsigned); | 56 .default_macro_constant_type(MacroTypeVariation::Signed); |
53 | 57 |
54 let generated = builder.generate().unwrap().to_string(); | 58 let generated = builder.generate().unwrap().to_string(); |
55 let file = syn::parse_file(&generated).unwrap(); | 59 let file = syn::parse_file(&generated).unwrap(); |
56 let mut tests = vec![]; | 60 let mut tests = vec![]; |
57 tests.push("{".into()); | 61 tests.push("{".into()); |