comparison libpam-sys/libpam-sys-test/build.rs @ 137:88627c057709 default tip

Add Sun PAM functions from Illumos headers.
author Paul Fisher <paul@pfish.zone>
date Thu, 03 Jul 2025 17:33:13 -0400
parents efbc235f01d3
children
comparison
equal deleted inserted replaced
136:efbc235f01d3 137:88627c057709
39 ], 39 ],
40 ignore_consts: vec!["OPENPAM_VERSION", "OPENPAM_RELEASE", "PAM_SOEXT"], 40 ignore_consts: vec!["OPENPAM_VERSION", "OPENPAM_RELEASE", "PAM_SOEXT"],
41 ..Default::default() 41 ..Default::default()
42 }, 42 },
43 PamImpl::Sun => TestConfig { 43 PamImpl::Sun => TestConfig {
44 headers: vec!["<security/pam_appl.h>", "<security/pam_modules.h>"], 44 headers: vec![
45 "<security/pam_appl.h>",
46 "<security/pam_modules.h>",
47 "\"illumos_pam_impl.h\"",
48 ],
45 ..Default::default() 49 ..Default::default()
46 }, 50 },
47 PamImpl::XSso => TestConfig { 51 PamImpl::XSso => TestConfig {
48 headers: vec!["\"xsso_pam_appl.h\""], 52 headers: vec!["\"xsso_pam_appl.h\""],
49 ..Default::default() 53 ..Default::default()
67 } 71 }
68 72
69 let generated = builder.generate().unwrap(); 73 let generated = builder.generate().unwrap();
70 generated.write_to_file(test_file("bindgen.rs")).unwrap(); 74 generated.write_to_file(test_file("bindgen.rs")).unwrap();
71 let file = syn::parse_file(&generated.to_string()).unwrap(); 75 let file = syn::parse_file(&generated.to_string()).unwrap();
72 let mut tests = vec!["\ 76 let mut tests = vec![
73 #[allow(dead_code, non_camel_case_types, non_upper_case_globals)] 77 "#[allow(deprecated, overflowing_literals)]".into(),
74 mod generated { 78 "fn main() {".into(),
75 include!(\"bindgen.rs\");
76 }
77 #[allow(deprecated, overflowing_literals)]
78 fn main() {
79 "
80 .into(),
81 format!( 79 format!(
82 "assert_eq!(libpam_sys::pam_impl::PamImpl::CURRENT, libpam_sys::pam_impl::PamImpl::{:?});", 80 "assert_eq!(libpam_sys::pam_impl::PamImpl::CURRENT, libpam_sys::pam_impl::PamImpl::{:?});",
83 PamImpl::CURRENT 81 PamImpl::CURRENT
84 ), 82 ),
85 ]; 83 ];
132 ("spwd", _) => "struct spwd".into(), 130 ("spwd", _) => "struct spwd".into(),
133 (name, true) => format!("struct {name}"), 131 (name, true) => format!("struct {name}"),
134 (other, false) => other.into(), 132 (other, false) => other.into(),
135 } 133 }
136 }); 134 });
135 test.field_name(|_, name| {
136 match name {
137 "type_" => "type",
138 other => other,
139 }
140 .into()
141 });
137 142
138 // 143 //
139 // Welcome to THE HACK ZONE. 144 // Welcome to THE HACK ZONE.
140 // 145 //
141 146