Mercurial > crates > nonstick
comparison libpam-sys/libpam-sys-test/build.rs @ 125:2b255c92417b
Introduce base PAM functions; use the real X/SSO PAM header for tests.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Mon, 30 Jun 2025 17:47:32 -0400 |
| parents | f469b8d9ad78 |
| children | c77846f3a979 |
comparison
equal
deleted
inserted
replaced
| 124:f469b8d9ad78 | 125:2b255c92417b |
|---|---|
| 1 use bindgen::MacroTypeVariation; | 1 use bindgen::MacroTypeVariation; |
| 2 use libpam_sys::PamImpl; | 2 use libpam_sys_impls::__pam_impl_enum__; |
| 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::{Item, ItemConst, Type, TypePath}; | 6 use syn::{Item, ItemConst, Type, TypePath}; |
| 7 | |
| 8 // We're using the macro directly so we can match exhaustively. | |
| 9 __pam_impl_enum__!(); | |
| 7 | 10 |
| 8 fn main() { | 11 fn main() { |
| 9 let config = match PamImpl::CURRENT { | 12 let config = match PamImpl::CURRENT { |
| 10 PamImpl::LinuxPam => TestConfig { | 13 PamImpl::LinuxPam => TestConfig { |
| 11 headers: vec![ | 14 headers: vec![ |
| 35 headers: vec!["<security/pam_appl.h>", "<security/pam_modules.h>"], | 38 headers: vec!["<security/pam_appl.h>", "<security/pam_modules.h>"], |
| 36 block_headers: vec!["sys/.*"], | 39 block_headers: vec!["sys/.*"], |
| 37 ..Default::default() | 40 ..Default::default() |
| 38 }, | 41 }, |
| 39 PamImpl::XSso => TestConfig { | 42 PamImpl::XSso => TestConfig { |
| 40 headers: vec!["\"xsso_constants.h\""], | 43 headers: vec!["\"xsso_pam_appl.h\""], |
| 41 ignore_consts: vec!["PAM_CRED_PRELIM_CHECK"], | 44 ignore_consts: vec!["PAM_CRED_PRELIM_CHECK"], |
| 42 ..Default::default() | 45 ..Default::default() |
| 43 }, | 46 }, |
| 44 other => panic!("Unknown PAM implementation {other:?}"), | |
| 45 }; | 47 }; |
| 46 generate_const_test(&config); | 48 generate_const_test(&config); |
| 47 } | 49 } |
| 48 | 50 |
| 49 fn generate_const_test(config: &TestConfig) { | 51 fn generate_const_test(config: &TestConfig) { |
