Conditionally disable macOS incompatible tests
authorWill <willhy@gmail.com>
Wed, 8 Nov 2017 03:52:34 +0000 (21:52 -0600)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 17 Dec 2018 00:24:15 +0000 (01:24 +0100)
Symbols _getgrent_r and _getpwent_r in
source4/torture/local/nss_tests.c are undefined in macOS. It seems
that checking HAVE_GETGRENT_R and HAVE_GETPWENT_R and conditionally
disabling those tests as suggested by hirochachacha in the referenced
bug allows samba on both `master` and `samba-4.7.1` to build properly
on macOS/darwin.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11984

Signed-off-by: Will Haley <willhy@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/torture/local/nss_tests.c

index cc02047..2943122 100644 (file)
@@ -346,6 +346,7 @@ static bool test_enum_r_passwd(struct torture_context *tctx,
        torture_comment(tctx, "Testing setpwent\n");
        setpwent();
 
+#ifdef HAVE_GETPWENT_R /* getpwent_r not supported on macOS */
        while (1) {
                torture_comment(tctx, "Testing getpwent_r\n");
 
@@ -368,6 +369,7 @@ static bool test_enum_r_passwd(struct torture_context *tctx,
                        num_pwd++;
                }
        }
+#endif /* getpwent_r not supported on macOS */
 
        torture_comment(tctx, "Testing endpwent\n");
        endpwent();
@@ -544,6 +546,7 @@ static bool test_enum_r_group(struct torture_context *tctx,
        torture_comment(tctx, "Testing setgrent\n");
        setgrent();
 
+#ifdef HAVE_GETGRENT_R /* getgrent_r not supported on macOS */
        while (1) {
                torture_comment(tctx, "Testing getgrent_r\n");
 
@@ -566,6 +569,7 @@ static bool test_enum_r_group(struct torture_context *tctx,
                        num_grp++;
                }
        }
+#endif /* getgrent_r not supported on macOS */
 
        torture_comment(tctx, "Testing endgrent\n");
        endgrent();