Test for binary,dwp symlinks into different directories.
authorDoug Evans <dje@google.com>
Wed, 12 Feb 2014 19:38:48 +0000 (11:38 -0800)
committerDoug Evans <dje@google.com>
Wed, 12 Feb 2014 19:38:48 +0000 (11:38 -0800)
* 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
gdb/testsuite/gdb.dwarf2/Makefile.in
gdb/testsuite/gdb.dwarf2/dwp-symlink.exp

index 6da4e1c6c5a56f861286ee73c8ac2c87f7a02e55..682ac2f80692f0016b5dfb45a0ffd0dc843a38a4 100644 (file)
@@ -1,3 +1,12 @@
+2014-02-12  Doug Evans  <dje@google.com>
+
+       * 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  <dje@google.com>
 
        * gdb.dwarf2/dwp-symlink.exp: Rewrite to use remote_* commands instead
index 978cdfd455f147e4ada71aa42eb1af26aacebff8..7697e8c0193ddd691b6debcc5ec959b28fce46c8 100644 (file)
@@ -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
index a0e18976a7ecb72525213b67f9569838af6e2dda..1b55c6858e3ce6cebec92ee83fcce4381415c5c8 100644 (file)
@@ -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"