|
|
00db10 |
commit a3fe6a20bf81ef6a97a761dac9050517e7fd7a1f
|
|
|
00db10 |
Author: DJ Delorie <dj@redhat.com>
|
|
|
00db10 |
Date: Thu Aug 17 17:58:25 2017 -0400
|
|
|
00db10 |
|
|
|
00db10 |
Update nss tests to new skeleton
|
|
|
00db10 |
|
|
|
00db10 |
* bug17079.c: Update to new test harness.
|
|
|
00db10 |
* test-digits-dots.c: Likewise.
|
|
|
00db10 |
* test-netdb.c: Likewise.
|
|
|
00db10 |
* tst-field.c: Likewise.
|
|
|
00db10 |
* tst-nss-getpwent.c: Likewise.
|
|
|
00db10 |
* tst-nss-static.c: Likewise.
|
|
|
00db10 |
* tst-nss-test1.c: Likewise.
|
|
|
00db10 |
* tst-nss-test2.c: Likewise.
|
|
|
00db10 |
* tst-nss-test3.c: Likewise.
|
|
|
00db10 |
* tst-nss-test4.c: Likewise.
|
|
|
00db10 |
* tst-nss-test5.c: Likewise.
|
|
|
00db10 |
|
|
|
00db10 |
Partial port of this patch - tst-field.c changes not ported.
|
|
|
00db10 |
|
|
|
00db10 |
diff --git a/nss/bug17079.c b/nss/bug17079.c
|
|
|
00db10 |
index 4171c7db55..09d33f018c 100644
|
|
|
00db10 |
--- a/nss/bug17079.c
|
|
|
00db10 |
+++ b/nss/bug17079.c
|
|
|
00db10 |
@@ -23,6 +23,8 @@
|
|
|
00db10 |
#include <stdlib.h>
|
|
|
00db10 |
#include <string.h>
|
|
|
00db10 |
|
|
|
00db10 |
+#include <support/support.h>
|
|
|
00db10 |
+
|
|
|
00db10 |
/* Check if two passwd structs contain the same data. */
|
|
|
00db10 |
static bool
|
|
|
00db10 |
equal (const struct passwd *a, const struct passwd *b)
|
|
|
00db10 |
@@ -52,13 +54,13 @@ init_test_items (void)
|
|
|
00db10 |
if (pwd == NULL)
|
|
|
00db10 |
break;
|
|
|
00db10 |
struct passwd *target = test_items + test_count;
|
|
|
00db10 |
- target->pw_name = strdup (pwd->pw_name);
|
|
|
00db10 |
- target->pw_passwd = strdup (pwd->pw_passwd);
|
|
|
00db10 |
+ target->pw_name = xstrdup (pwd->pw_name);
|
|
|
00db10 |
+ target->pw_passwd = xstrdup (pwd->pw_passwd);
|
|
|
00db10 |
target->pw_uid = pwd->pw_uid;
|
|
|
00db10 |
target->pw_gid = pwd->pw_gid;
|
|
|
00db10 |
- target->pw_gecos = strdup (pwd->pw_gecos);
|
|
|
00db10 |
- target->pw_dir = strdup (pwd->pw_dir);
|
|
|
00db10 |
- target->pw_shell = strdup (pwd->pw_shell);
|
|
|
00db10 |
+ target->pw_gecos = xstrdup (pwd->pw_gecos);
|
|
|
00db10 |
+ target->pw_dir = xstrdup (pwd->pw_dir);
|
|
|
00db10 |
+ target->pw_shell = xstrdup (pwd->pw_shell);
|
|
|
00db10 |
}
|
|
|
00db10 |
while (++test_count < MAX_TEST_ITEMS);
|
|
|
00db10 |
endpwent ();
|
|
|
00db10 |
@@ -108,13 +110,7 @@ static void
|
|
|
00db10 |
test_one (const struct passwd *item, size_t buffer_size,
|
|
|
00db10 |
char pad, size_t padding_size)
|
|
|
00db10 |
{
|
|
|
00db10 |
- char *buffer = malloc (buffer_size + padding_size);
|
|
|
00db10 |
- if (buffer == NULL)
|
|
|
00db10 |
- {
|
|
|
00db10 |
- puts ("error: malloc failure");
|
|
|
00db10 |
- errors = true;
|
|
|
00db10 |
- return;
|
|
|
00db10 |
- }
|
|
|
00db10 |
+ char *buffer = xmalloc (buffer_size + padding_size);
|
|
|
00db10 |
|
|
|
00db10 |
struct passwd pwd;
|
|
|
00db10 |
struct passwd *result;
|
|
|
00db10 |
@@ -240,5 +236,4 @@ do_test (void)
|
|
|
00db10 |
return 0;
|
|
|
00db10 |
}
|
|
|
00db10 |
|
|
|
00db10 |
-#define TEST_FUNCTION do_test ()
|
|
|
00db10 |
-#include "../test-skeleton.c"
|
|
|
00db10 |
+#include <support/test-driver.c>
|
|
|
00db10 |
diff --git a/nss/test-digits-dots.c b/nss/test-digits-dots.c
|
|
|
00db10 |
index 2685161e65..5b898a932d 100644
|
|
|
00db10 |
--- a/nss/test-digits-dots.c
|
|
|
00db10 |
+++ b/nss/test-digits-dots.c
|
|
|
00db10 |
@@ -21,6 +21,8 @@
|
|
|
00db10 |
#include <netdb.h>
|
|
|
00db10 |
#include <errno.h>
|
|
|
00db10 |
|
|
|
00db10 |
+#include <support/support.h>
|
|
|
00db10 |
+
|
|
|
00db10 |
static int
|
|
|
00db10 |
do_test (void)
|
|
|
00db10 |
{
|
|
|
00db10 |
@@ -34,5 +36,4 @@ do_test (void)
|
|
|
00db10 |
return err == ERANGE && h_err == NETDB_INTERNAL ? EXIT_SUCCESS : EXIT_FAILURE;
|
|
|
00db10 |
}
|
|
|
00db10 |
|
|
|
00db10 |
-#define TEST_FUNCTION do_test ()
|
|
|
00db10 |
-#include "../test-skeleton.c"
|
|
|
00db10 |
+#include <support/test-driver.c>
|
|
|
00db10 |
diff --git a/nss/tst-nss-static.c b/nss/tst-nss-static.c
|
|
|
00db10 |
index 98cf073deb..6c3dc07622 100644
|
|
|
00db10 |
--- a/nss/tst-nss-static.c
|
|
|
00db10 |
+++ b/nss/tst-nss-static.c
|
|
|
00db10 |
@@ -1,7 +1,8 @@
|
|
|
00db10 |
/* glibc test for static NSS. */
|
|
|
00db10 |
#include <stdio.h>
|
|
|
00db10 |
|
|
|
00db10 |
-#define TEST_FUNCTION do_test ()
|
|
|
00db10 |
+#include <support/support.h>
|
|
|
00db10 |
+
|
|
|
00db10 |
static int
|
|
|
00db10 |
do_test (void)
|
|
|
00db10 |
{
|
|
|
00db10 |
@@ -12,4 +13,4 @@ do_test (void)
|
|
|
00db10 |
}
|
|
|
00db10 |
|
|
|
00db10 |
|
|
|
00db10 |
-#include "../test-skeleton.c"
|
|
|
00db10 |
+#include <support/test-driver.c>
|
|
|
00db10 |
diff --git a/nss/tst-nss-test2.c b/nss/tst-nss-test2.c
|
|
|
00db10 |
index 11c2edf118..ac45d58c4b 100644
|
|
|
00db10 |
--- a/nss/tst-nss-test2.c
|
|
|
00db10 |
+++ b/nss/tst-nss-test2.c
|
|
|
00db10 |
@@ -22,6 +22,8 @@
|
|
|
00db10 |
#include <stdlib.h>
|
|
|
00db10 |
#include <string.h>
|
|
|
00db10 |
|
|
|
00db10 |
+#include <support/support.h>
|
|
|
00db10 |
+
|
|
|
00db10 |
#include "nss_test.h"
|
|
|
00db10 |
|
|
|
00db10 |
/* The data in these tables is arbitrary, but the merged data based on
|
|
|
00db10 |
@@ -132,5 +134,4 @@ do_test (void)
|
|
|
00db10 |
return retval;
|
|
|
00db10 |
}
|
|
|
00db10 |
|
|
|
00db10 |
-#define TEST_FUNCTION do_test ()
|
|
|
00db10 |
-#include "../test-skeleton.c"
|
|
|
00db10 |
+#include <support/test-driver.c>
|
|
|
00db10 |
diff --git a/nss/tst-nss-test3.c b/nss/tst-nss-test3.c
|
|
|
00db10 |
index 308708f387..5098aae67b 100644
|
|
|
00db10 |
--- a/nss/tst-nss-test3.c
|
|
|
00db10 |
+++ b/nss/tst-nss-test3.c
|
|
|
00db10 |
@@ -20,7 +20,8 @@
|
|
|
00db10 |
#include <stdio.h>
|
|
|
00db10 |
#include <stdlib.h>
|
|
|
00db10 |
#include <string.h>
|
|
|
00db10 |
-#include <sys/signal.h>
|
|
|
00db10 |
+
|
|
|
00db10 |
+#include <support/support.h>
|
|
|
00db10 |
|
|
|
00db10 |
#include "nss_test.h"
|
|
|
00db10 |
|
|
|
00db10 |
@@ -146,5 +147,4 @@ do_test (void)
|
|
|
00db10 |
}
|
|
|
00db10 |
}
|
|
|
00db10 |
|
|
|
00db10 |
-#define TEST_FUNCTION do_test ()
|
|
|
00db10 |
-#include "../test-skeleton.c"
|
|
|
00db10 |
+#include <support/test-driver.c>
|
|
|
00db10 |
diff --git a/nss/tst-nss-test4.c b/nss/tst-nss-test4.c
|
|
|
00db10 |
index 731e0ed10a..6e0ac84acc 100644
|
|
|
00db10 |
--- a/nss/tst-nss-test4.c
|
|
|
00db10 |
+++ b/nss/tst-nss-test4.c
|
|
|
00db10 |
@@ -20,7 +20,8 @@
|
|
|
00db10 |
#include <stdio.h>
|
|
|
00db10 |
#include <stdlib.h>
|
|
|
00db10 |
#include <string.h>
|
|
|
00db10 |
-#include <sys/signal.h>
|
|
|
00db10 |
+
|
|
|
00db10 |
+#include <support/support.h>
|
|
|
00db10 |
|
|
|
00db10 |
#include "nss_test.h"
|
|
|
00db10 |
|
|
|
00db10 |
@@ -133,5 +134,4 @@ do_test (void)
|
|
|
00db10 |
}
|
|
|
00db10 |
}
|
|
|
00db10 |
|
|
|
00db10 |
-#define TEST_FUNCTION do_test ()
|
|
|
00db10 |
-#include "../test-skeleton.c"
|
|
|
00db10 |
+#include <support/test-driver.c>
|
|
|
00db10 |
diff --git a/nss/tst-nss-test5.c b/nss/tst-nss-test5.c
|
|
|
00db10 |
index fef41f08df..8f02cb7779 100644
|
|
|
00db10 |
--- a/nss/tst-nss-test5.c
|
|
|
00db10 |
+++ b/nss/tst-nss-test5.c
|
|
|
00db10 |
@@ -22,6 +22,8 @@
|
|
|
00db10 |
#include <stdlib.h>
|
|
|
00db10 |
#include <string.h>
|
|
|
00db10 |
|
|
|
00db10 |
+#include <support/support.h>
|
|
|
00db10 |
+
|
|
|
00db10 |
#include "nss_test.h"
|
|
|
00db10 |
|
|
|
00db10 |
/* The specific values and names used here are arbitrary, other than
|
|
|
00db10 |
@@ -104,5 +106,4 @@ do_test (void)
|
|
|
00db10 |
}
|
|
|
00db10 |
}
|
|
|
00db10 |
|
|
|
00db10 |
-#define TEST_FUNCTION do_test ()
|
|
|
00db10 |
-#include "../test-skeleton.c"
|
|
|
00db10 |
+#include <support/test-driver.c>
|