]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - libiberty/testsuite/test-pexecute.c
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / libiberty / testsuite / test-pexecute.c
index c67bcefb8f680ec889b5627f902a219fbb0bee23..c26296f0d13414ef5f4f2b3afd78ffabbee82c46 100644 (file)
@@ -1,5 +1,5 @@
 /* Pexecute test program,
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005-2021 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@airs.com>.
 
    This file is part of GNU libiberty.
@@ -16,7 +16,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -208,11 +208,12 @@ main (int argc, char **argv)
   do                                                                   \
     {                                                                  \
       int err;                                                         \
+      const char *pex_run_err;                                         \
       if (trace)                                                       \
        fprintf (stderr, "Line %d: running %s %s\n",                    \
                 __LINE__, EXECUTABLE, ARGV[0]);                        \
-      const char *pex_run_err = pex_run (PEXOBJ, FLAGS, EXECUTABLE,    \
-                                        ARGV, OUTNAME, ERRNAME, &err); \
+      pex_run_err = pex_run (PEXOBJ, FLAGS, EXECUTABLE, ARGV, OUTNAME, \
+                            ERRNAME, &err);                            \
       if (pex_run_err != NULL)                                         \
        FATAL_ERROR (pex_run_err, err);                                 \
     }                                                                  \
@@ -284,6 +285,20 @@ main (int argc, char **argv)
     ERROR ("echo exit status failed");
   pex_free (pex1);
 
+  /* Check empty parameters don't get lost.  */
+  pex1 = TEST_PEX_INIT (PEX_USE_PIPES, "temp");
+  subargv[1] = "echo";
+  subargv[2] = "foo";
+  subargv[3] = "";
+  subargv[4] = "bar";
+  subargv[5] = NULL;
+  TEST_PEX_RUN (pex1, 0, "./test-pexecute", subargv, NULL, NULL);
+  e = TEST_PEX_READ_OUTPUT (pex1);
+  CHECK_LINE (e, "foo  bar");  /* Two spaces!  */
+  if (TEST_PEX_GET_STATUS_1 (pex1) != 0)
+    ERROR ("echo exit status failed");
+  pex_free (pex1);
+
   pex1 = TEST_PEX_INIT (PEX_USE_PIPES, "temp");
   subargv[1] = "echo";
   subargv[2] = "bar";