diff 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
line wrap: on
line diff
--- a/libpam-sys/libpam-sys-test/build.rs	Thu Jul 03 14:28:04 2025 -0400
+++ b/libpam-sys/libpam-sys-test/build.rs	Thu Jul 03 17:33:13 2025 -0400
@@ -41,7 +41,11 @@
             ..Default::default()
         },
         PamImpl::Sun => TestConfig {
-            headers: vec!["<security/pam_appl.h>", "<security/pam_modules.h>"],
+            headers: vec![
+                "<security/pam_appl.h>",
+                "<security/pam_modules.h>",
+                "\"illumos_pam_impl.h\"",
+            ],
             ..Default::default()
         },
         PamImpl::XSso => TestConfig {
@@ -69,15 +73,9 @@
     let generated = builder.generate().unwrap();
     generated.write_to_file(test_file("bindgen.rs")).unwrap();
     let file = syn::parse_file(&generated.to_string()).unwrap();
-    let mut tests = vec!["\
-            #[allow(dead_code, non_camel_case_types, non_upper_case_globals)]
-            mod generated {
-                include!(\"bindgen.rs\");
-            }
-            #[allow(deprecated, overflowing_literals)]
-            fn main() {
-        "
-        .into(),
+    let mut tests = vec![
+        "#[allow(deprecated, overflowing_literals)]".into(),
+        "fn main() {".into(),
         format!(
             "assert_eq!(libpam_sys::pam_impl::PamImpl::CURRENT, libpam_sys::pam_impl::PamImpl::{:?});",
             PamImpl::CURRENT
@@ -134,6 +132,13 @@
             (other, false) => other.into(),
         }
     });
+    test.field_name(|_, name| {
+        match name {
+            "type_" => "type",
+            other => other,
+        }
+        .into()
+    });
 
     //
     // Welcome to THE HACK ZONE.