]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite, jit: fix test-error-pr63969-missing-driver.c
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 15 Oct 2024 14:59:48 +0000 (10:59 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 15 Oct 2024 14:59:48 +0000 (10:59 -0400)
jit.dg/test-error-pr63969-missing-driver.c tries to break PATH and
verify that an error is generated when using an external driver.

However it does this by unsetting PATH, and so the test could
accidentally find the driver if the system supplies a default and the
driver happens to be installed in that path (reported as rhbz#2318021).

Fix the test by instead setting PATH to a bogus value.

gcc/testsuite/ChangeLog:
* jit.dg/test-error-pr63969-missing-driver.c (create_code): When
breaking PATH, use setenv with a bogus value, rather than
unsetenv, in case the system uses a default path that contains
the driver binary.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/testsuite/jit.dg/test-error-pr63969-missing-driver.c

index 733522310debfcdd7a11f4f67deb2ae38251a3d7..152e236443cc5cebd398fc141ee347704c071f1f 100644 (file)
@@ -28,7 +28,7 @@ create_code (gcc_jit_context *ctxt, void *user_data)
   /* Break PATH, so that the driver can't be found
      by gcc::jit::playback::context::compile ()
      within gcc_jit_context_compile.  */
-  unsetenv ("PATH");
+  setenv ("PATH", "/this/is/not/a/valid/path", 1);
 }
 
 void