From b1064352592065e9be3448cdcdcff32a4f71625d Mon Sep 17 00:00:00 2001
From: Andre Maroneze <andre.maroneze@cea.fr>
Date: Mon, 6 Jan 2025 09:39:51 +0100
Subject: [PATCH] [tests] avoid race condition in test

When tests are run in parallel, using the same name for two test outputs might
truncate it before it is written, leading to a non-deterministic oracle.
---
 tests/syntax/empty_union.i                   | 4 ++--
 tests/syntax/oracle/empty_union.0.res.oracle | 2 +-
 tests/syntax/oracle/empty_union.1.res.oracle | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/syntax/empty_union.i b/tests/syntax/empty_union.i
index 4b656499b0..5862ca0800 100644
--- a/tests/syntax/empty_union.i
+++ b/tests/syntax/empty_union.i
@@ -1,6 +1,6 @@
 /* run.config*
-   STDOPT: +"-machdep gcc_x86_32 -print -ocode @PTEST_NAME@_reparse.c -then @PTEST_NAME@_reparse.c -ocode=''"
-   STDOPT: +"-machdep msvc_x86_64 -print -ocode @PTEST_NAME@_reparse.c -then @PTEST_NAME@_reparse.c -ocode=''"
+   STDOPT: +"-machdep gcc_x86_32 -print -ocode @PTEST_NAME@_@PTEST_NUMBER@_reparse.c -then @PTEST_NAME@_@PTEST_NUMBER@_reparse.c -ocode=''"
+   STDOPT: +"-machdep msvc_x86_64 -print -ocode @PTEST_NAME@_@PTEST_NUMBER@_reparse.c -then @PTEST_NAME@_@PTEST_NUMBER@_reparse.c -ocode=''"
  EXIT: 1
    STDOPT:
  */
diff --git a/tests/syntax/oracle/empty_union.0.res.oracle b/tests/syntax/oracle/empty_union.0.res.oracle
index 7d386369f1..9a2d28d119 100644
--- a/tests/syntax/oracle/empty_union.0.res.oracle
+++ b/tests/syntax/oracle/empty_union.0.res.oracle
@@ -1,5 +1,5 @@
 [kernel] Parsing empty_union.i (no preprocessing)
-[kernel] Parsing empty_union_reparse.c (with preprocessing)
+[kernel] Parsing empty_union_0_reparse.c (with preprocessing)
 /* Generated by Frama-C */
 union empty {
    
diff --git a/tests/syntax/oracle/empty_union.1.res.oracle b/tests/syntax/oracle/empty_union.1.res.oracle
index 7d386369f1..ed84f1542e 100644
--- a/tests/syntax/oracle/empty_union.1.res.oracle
+++ b/tests/syntax/oracle/empty_union.1.res.oracle
@@ -1,5 +1,5 @@
 [kernel] Parsing empty_union.i (no preprocessing)
-[kernel] Parsing empty_union_reparse.c (with preprocessing)
+[kernel] Parsing empty_union_1_reparse.c (with preprocessing)
 /* Generated by Frama-C */
 union empty {
    
-- 
GitLab