@@ -1,2 +1,3 @@
cp $B/nss/libnss_test1.so $L/libnss_test1.so.2
cp $B/nss/libnss_test2.so $L/libnss_test2.so.2
+exec /usr/bin/foo
@@ -95,6 +95,7 @@ int verbose = 0;
mv FILE FILE
cp FILE FILE
rm FILE
+ exec PATH
FILE must start with $B/, $S/, $I/, $L/, or /
(expands to build dir, source dir, install dir, library dir
(in container), or container's root)
@@ -104,6 +105,7 @@ int verbose = 0;
- 'mv': A minimal move files command.
- 'cp': A minimal copy files command.
- 'rm': A minimal remove files command.
+ - 'exec': change where test is run from (may end in /)
* mytest.root/postclean.req causes fresh rsync (with delete) after
test if present
@@ -868,7 +870,9 @@ main (int argc, char **argv)
the_words[i] = concat (new_root_path,
support_libdir_prefix,
the_words[i] + 2, NULL);
- else if (the_words[i][0] == '/')
+ /* "exec" uses inside-root paths. */
+ else if (strcmp (the_words[0], "exec") != 0
+ && the_words[i][0] == '/')
the_words[i] = concat (new_root_path,
the_words[i], NULL);
}
@@ -912,6 +916,33 @@ main (int argc, char **argv)
{
maybe_xunlink (the_words[1]);
}
+ else if (nt == 2 && strcmp (the_words[0], "exec") == 0)
+ {
+ char *new_exec_path = the_words[1];
+ char *test_basename = new_child_proc[0];
+
+ /* Find the base name of the test. */
+ if (strrchr (test_basename, '/') != NULL)
+ test_basename = strrchr (test_basename, '/') + 1;
+
+ /* If the new exec path ends with a slash, that's the
+ * directory, and use the old test base name. */
+ if (new_exec_path [strlen(new_exec_path) - 1] == '/')
+ new_exec_path = concat (new_exec_path,
+ test_basename,
+ NULL);
+
+
+ /* new_child_proc is in the build tree, so has the
+ same path inside the chroot as outside. The new
+ exec path is, by definition, relative to the
+ chroot. */
+ copy_one_file (new_child_proc[0], concat (new_root_path,
+ new_exec_path,
+ NULL));
+
+ new_child_proc[0] = strdup (new_exec_path);
+ }
else if (nt == 1 && strcmp (the_words[0], "su") == 0)
{
be_su = 1;