This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/3] Support run bug-setlocale1 directly


Hi,

This patch supports run bug-setlocale1 directly.  It also fixed a typo
in do_test.  OK for 2.18?

Thanks.


H.J.
---
 ChangeLog.direct            |  8 ++++++++
 localedata/Makefile         |  2 +-
 localedata/bug-setlocale1.c | 27 ++++++++++++++++++---------
 3 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/ChangeLog.direct b/ChangeLog.direct
index df9aa4d..57e62bc 100644
--- a/ChangeLog.direct
+++ b/ChangeLog.direct
@@ -8,3 +8,11 @@
 	* posix/tst-spawn-static.c: Likewise.
 	* posix/tst-exec.c: Support run directly.
 	* posix/tst-spawn.c: Likewise.
+
+localedata/
+
+2012-12-20  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* Makefile (bug-setlocale1-ARGS): Set to -- $(built-program-cmd).
+	* bug-setlocale1.c (do_test): Support run directly.  Check env[1]
+	instead of newargv[0].
diff --git a/localedata/Makefile b/localedata/Makefile
index 9501a79..cbe6055 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -285,7 +285,7 @@ $(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@
 
 bug-setlocale1-ENV = LOCPATH=$(common-objpfx)localedata
-bug-setlocale1-ARGS = $(common-objpfx)
+bug-setlocale1-ARGS = -- $(built-program-cmd)
 tst-setlocale2-ENV = LOCPATH=$(common-objpfx)localedata
 
 $(objdir)/iconvdata/gconv-modules:
diff --git a/localedata/bug-setlocale1.c b/localedata/bug-setlocale1.c
index cf787be..7fc9bb9 100644
--- a/localedata/bug-setlocale1.c
+++ b/localedata/bug-setlocale1.c
@@ -12,16 +12,25 @@ do_test (int argc, char *argv[])
   if (argc > 1)
     {
       char *newargv[5];
-      asprintf (&newargv[0], "%self/ld.so", argv[1]);
-      if (newargv[0] == NULL)
+      if (argc != 2 && argc != 5)
 	{
-	  puts ("asprintf failed");
+	  printf ("wrong number of arguments (%d)\n", argc);
 	  return 1;
 	}
-      newargv[1] = (char *) "--library-path";
-      newargv[2] = argv[1];
-      newargv[3] = argv[0];
-      newargv[4] = NULL;
+
+      if (argc == 2)
+	{
+	  newargv[0] = argv[0];
+	  newargv[1] = NULL;
+	}
+      else
+	{
+	  newargv[0] = argv[1];
+	  newargv[1] = argv[2];
+	  newargv[2] = argv[3];
+	  newargv[3] = argv[4];
+	  newargv[4] = NULL;
+	}
 
       char *env[3];
       env[0] = (char *) "LC_CTYPE=de_DE.UTF-8";
@@ -32,9 +41,9 @@ do_test (int argc, char *argv[])
 	  return 1;
 	}
       asprintf (&env[1], "LOCPATH=%s", loc);
-      if (newargv[0] == NULL)
+      if (env[1] == NULL)
 	{
-	  puts ("second asprintf failed");
+	  puts ("asprintf failed");
 	  return 1;
 	}
       env[2] = NULL;
-- 
1.7.11.7


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]