[3/4] binutils/testsuite: Store server database in tmpdir

Message ID CAJDtP-RPhh+rBN2hq8-EkX=rUjC0ztRqLkiz6O9=YeOHKmVYNQ@mail.gmail.com
State New
Headers show
Series
  • [1/4] binutils/testsuite: Replace set ::env with setenv
Related show

Commit Message

Aaron Merey Jan. 17, 2020, 3:32 a.m.

Patch

binutils/testsuite: Store server database in tmpdir.

Specify tmpdir as the location of the server's database.
Otherwise it will be written to $HOME, the default location.

	* binutils/testsuite/binutils-all/debuginfod.exp:
	Specify tmpdir as the location of the server's
	database.
---
 binutils/testsuite/binutils-all/debuginfod.exp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/binutils/testsuite/binutils-all/debuginfod.exp b/binutils/testsuite/binutils-all/debuginfod.exp
index 200224f75b..42a861d084 100644
--- a/binutils/testsuite/binutils-all/debuginfod.exp
+++ b/binutils/testsuite/binutils-all/debuginfod.exp
@@ -75,8 +75,8 @@  if { ![binutils_assemble $srcdir/$subdir/linkdebug.s tmpdir/linkdebug.debug] } {
 # Find an unused port
 set port [exec sh -c "while true; do PORT=`expr '(' \$RANDOM % 1000 ')' + 9000`; ss -atn | fgrep \":\$PORT\" || break; done; echo \$PORT"]
 
-# Specify the directory that files retrieved from the server are written to.
 set cache [file join [pwd] "tmpdir/.debuginfod_cache"]
+set db [file join [pwd] "tmpdir/.debuginfod.db"]
 
 setenv DEBUGINFOD_URLS ""
 setenv DEBUGINFOD_TIMEOUT 30
@@ -88,8 +88,9 @@  file mkdir tmpdir/dbg
 file rename -force tmpdir/testprog.debug tmpdir/dbg
 file rename -force tmpdir/linkdebug.debug tmpdir/dbg
 
-# Remove an old cache if it exists
+# Remove old cache and database if they exist.
 file delete -force $cache
+file delete -force $db
 
 # Check whether objdump and readelf are configured with debuginfod.
 # To check this we attempt to follow a broken debuglink. If configured
@@ -114,7 +115,7 @@  proc sigint_handler {} {
 trap sigint_handler INT
 
 # Start a debuginfod server.
-set debuginfod_pid [exec debuginfod -p $port -F tmpdir/dbg 2>/dev/null &]
+set debuginfod_pid [exec debuginfod -d $db -p $port -F tmpdir/dbg 2>/dev/null &]
 
 if { !$debuginfod_pid } {
     fail "$test (server init)"
@@ -187,5 +188,4 @@  if { [regexp ".*DEBUGINFOD.*" $conf_readelf] } {
     untested "$test (readelf not configured with debuginfod)"
 }
 
-file delete -force $cache
 catch {exec kill -INT $debuginfod_pid}
-- 
2.23.0