[gdb/testsuite] Fix "text file busy" errors with cc-with-tweaks.exp
authorTom de Vries <tdevries@suse.de>
Fri, 6 Mar 2020 17:03:01 +0000 (18:03 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 6 Mar 2020 17:03:01 +0000 (18:03 +0100)
commit436b5e99c8eef55433f2c1de35d8f960425aa4c1
treedaa48dfa8928d6d145a188d50a5a6881d8fccb39
parent31bf18645d98b4d3d7357353be840e320649a67d
[gdb/testsuite] Fix "text file busy" errors with cc-with-tweaks.exp

When using target board cc-with-gdb-index.exp and running tests in parallel,
we run into:
...
gdb compile failed, gdb/contrib/gdb-add-index.sh: line 86: \
  build/gdb/testsuite/gdb.sh: Text file busy
...

The problem is that because of the parallel test run, gdb.sh is created for
every single test-case, and eventually gdb.sh is overwritten while being
executed.

Fix this by creating gdb.sh only once.

Tested on x86_64-linux with target board cc-with-gdb-index.exp, using both a
serial and parallel -j 5 test run.

gdb/testsuite/ChangeLog:

2020-03-06  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (tentative_rename, cached_file): New proc.
* boards/cc-with-tweaks.exp: Use cached_file to create gdb.sh.
gdb/testsuite/ChangeLog
gdb/testsuite/boards/cc-with-tweaks.exp
gdb/testsuite/lib/gdb.exp