From 563e8d85161198df8a13de4bc660a047305458c9 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Wed, 29 Oct 2014 21:43:05 +0800 Subject: [PATCH] Prepare directory in case test_system fails In gdb.base/fileio.c, some functions may depend on others. For example, test_rename renames a file to one directory which is created in test_system. That is means, if test_system fails, test_rename fails too, which is not a good practise, IMO. In test_system, system ("mkdir -p XX") is used to create directories needed for test_rename. In this patch, we use dejagnu remote_exec proc to create these directories on host. In my gdb testing, mingw32 host and arm-none-eabi target, system ("mkdir -p XX") doesn't work properly (this issue can be addressed separately), and this patch fixes the following fails. FAIL: gdb.base/fileio.exp: Renaming a directory to a non-empty directory returns ENOTEMPTY or EEXIST FAIL: gdb.base/fileio.exp: Unlink a file FAIL: gdb.base/fileio.exp: Unlinking a file in a directory w/o write access returns EACCES gdb/testsuite: 2014-10-29 Yao Qi * gdb.base/fileio.exp: Make directories on host. --- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.base/fileio.exp | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 5b7e94c6ef8..3c51ba12d50 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-10-29 Yao Qi + + * gdb.base/fileio.exp: Make directories on host. + 2014-10-29 Yao Qi * gdb.base/fileio.c (test_write): Close the file. diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp index 89f0997c71e..00c2b16fab9 100644 --- a/gdb/testsuite/gdb.base/fileio.exp +++ b/gdb/testsuite/gdb.base/fileio.exp @@ -210,6 +210,13 @@ gdb_test continue \ "Continuing\\..*system 4:.*OK$stop_msg" \ "System with invalid command returns 127" +# Prepare the directory for rename tests in case that test_system +# failed to create. +set dir1 [file join $outdir "dir1.fileio.test" "subdir.fileio.test"] +remote_exec host "mkdir -p $dir1" +set dir1 [file join $outdir "dir2.fileio.test"] +remote_exec host "mkdir $dir1" + gdb_test continue \ "Continuing\\..*rename 1:.*OK$stop_msg" \ "Rename a file" -- 2.30.2