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.

Successfully regrtested on x86_64-pc-linux-gnu.
Pushed to trunk as r15-4360-gf8dcb559e615db.

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 <dmalc...@redhat.com>
---
 gcc/testsuite/jit.dg/test-error-pr63969-missing-driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/testsuite/jit.dg/test-error-pr63969-missing-driver.c 
b/gcc/testsuite/jit.dg/test-error-pr63969-missing-driver.c
index 733522310deb..152e236443cc 100644
--- a/gcc/testsuite/jit.dg/test-error-pr63969-missing-driver.c
+++ b/gcc/testsuite/jit.dg/test-error-pr63969-missing-driver.c
@@ -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
-- 
2.26.3

Reply via email to