From 85f224e7e045553393c6297736fdf05155d2aeb9 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Wed, 12 Feb 2014 11:38:48 -0800 Subject: [PATCH] Test for binary,dwp symlinks into different directories. * gdb.dwarf2/Makefile.in (EXECUTABLES): Add dwp-symlink. (MISCELLANEOUS): New variable. (clean): rm -rf $(MISCELLANEOUS). * gdb.dwarf2/dwp-symlink.exp: Test the case where the executable and dwp live in the same directory as symlinks, with each symlink pointed to a differently named file in a different directory. --- gdb/testsuite/ChangeLog | 9 ++++++ gdb/testsuite/gdb.dwarf2/Makefile.in | 8 ++++- gdb/testsuite/gdb.dwarf2/dwp-symlink.exp | 39 ++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6da4e1c6c5a..682ac2f8069 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2014-02-12 Doug Evans + + * gdb.dwarf2/Makefile.in (EXECUTABLES): Add dwp-symlink. + (MISCELLANEOUS): New variable. + (clean): rm -rf $(MISCELLANEOUS). + * gdb.dwarf2/dwp-symlink.exp: Test the case where the executable and + dwp live in the same directory as symlinks, with each symlink pointed + to a differently named file in a different directory. + 2014-02-11 Doug Evans * gdb.dwarf2/dwp-symlink.exp: Rewrite to use remote_* commands instead diff --git a/gdb/testsuite/gdb.dwarf2/Makefile.in b/gdb/testsuite/gdb.dwarf2/Makefile.in index 978cdfd455f..7697e8c0193 100644 --- a/gdb/testsuite/gdb.dwarf2/Makefile.in +++ b/gdb/testsuite/gdb.dwarf2/Makefile.in @@ -21,7 +21,12 @@ VPATH = @srcdir@ srcdir = @srcdir@ EXECUTABLES = *.x pr10770 dw2-cp-infcall-ref-static dw2-inline-param \ - dw2-noloc dw2-ranges dw2-ref-missing-frame dw2-unresolved gdb-index + dw2-noloc dw2-ranges dw2-ref-missing-frame dw2-unresolved gdb-index \ + dwp-symlink + +MISCELLANEOUS = \ + dwp-symlink.dwp dwp-symlink-thelink dwp-symlink-thelink.dwp \ + dwp-dir1 dwp-dir2 dwp-dir3 all info install-info dvi install uninstall installcheck check: @echo "Nothing to be done for $@..." @@ -31,6 +36,7 @@ clean mostlyclean: -rm -f core core.coremaker coremaker.core corefile -rm -f *.dwo *.dwp -rm -f $(EXECUTABLES) + -rm -rf $(MISCELLANEOUS) -rm -f *.gdb-index *.with-index distclean maintainer-clean realclean: clean diff --git a/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp b/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp index a0e18976a7e..1b55c6858e3 100644 --- a/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp +++ b/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp @@ -87,5 +87,44 @@ gdb_test "cd .." "Working directory .*" gdb_test "ptype main" {type = int \(int, char \*\*\)} \ "relative path, binary symlink, dwp at symlink" +# Rename the dwp file back to its original name. +remote_exec host "mv -f [standard_output_file ${thelink}.dwp] [standard_output_file ${testfile}.dwp]" + # N.B. At this point the active gdb is in, essentially, some random directory. # Restart a new copy if you add more tests here. + +# Now verify that the following scenario works: +# dir1/real-binary-with-random-name +# dir2/real-dwp-with-random-name +# dir3/symlink-to-real-binary +# dir3/symlink-to-real-binary.dwp + +set dwp_bin_dir [standard_output_file dwp-dir1] +set dwp_dwp_dir [standard_output_file dwp-dir2] +set dwp_symlink_dir [standard_output_file dwp-dir3] +set dwp_real_binary "dwp-abc" +set dwp_real_dwp "dwp-def" +set dwp_symlink_binary "dwp-symlink-binary" +set dwp_symlink_dwp "${dwp_symlink_binary}.dwp" + +remote_exec host "rm -rf ${dwp_bin_dir}" +remote_exec host "rm -rf ${dwp_dwp_dir}" +remote_exec host "rm -rf ${dwp_symlink_dir}" +remote_exec host "mkdir ${dwp_bin_dir}" +remote_exec host "mkdir ${dwp_dwp_dir}" +remote_exec host "mkdir ${dwp_symlink_dir}" +remote_exec host "cp [standard_output_file $testfile] ${dwp_bin_dir}/${dwp_real_binary}" +remote_exec host "cp [standard_output_file ${testfile}.dwp] ${dwp_dwp_dir}/${dwp_real_dwp}" +# We don't test for failure to create the symlink here. +# We assume that if the above symlinks are created ok, these will be too. +remote_exec host "ln -sf ${dwp_bin_dir}/${dwp_real_binary} ${dwp_symlink_dir}/${dwp_symlink_binary}" +remote_exec host "ln -sf ${dwp_dwp_dir}/${dwp_real_dwp} ${dwp_symlink_dir}/${dwp_symlink_dwp}" + +clean_restart "${dwp_symlink_dir}/${dwp_symlink_binary}" + +if ![runto_main] { + return -1 +} + +gdb_test {print argv[0]} "/${dwp_symlink_binary}\"" \ + "separate executable/dwp symlinks" -- 2.30.2