More cygwin fixes
[platform/upstream/libffi.git] / patches / win32_tests
1 Index: libffi/ChangeLog
2 ===================================================================
3 --- libffi.orig/ChangeLog
4 +++ libffi/ChangeLog
5 @@ -1,3 +1,10 @@
6 +2012-03-21  Peter Rosin  <peda@lysator.liu.se>
7 +
8 +       * testsuite/lib/target-libpath.exp [*-*-cygwin*, *-*-mingw*]
9 +       (set_ld_library_path_env_vars): Add the library search dir to PATH
10 +       (and save PATH for later).
11 +       (restore_ld_library_path_env_vars): Restore PATH.
12 +
13  2012-03-20  Peter Rosin  <peda@lysator.liu.se>
14  
15         * testsuite/libffi.call/strlen2_win32.c (main): Remove bug.
16 Index: libffi/testsuite/lib/target-libpath.exp
17 ===================================================================
18 --- libffi.orig/testsuite/lib/target-libpath.exp
19 +++ libffi/testsuite/lib/target-libpath.exp
20 @@ -25,7 +25,7 @@ set orig_ld_library64_path_saved 0
21  set orig_ld_library_path_32_saved 0
22  set orig_ld_library_path_64_saved 0
23  set orig_dyld_library_path_saved 0
24 -
25 +set orig_path_saved 0
26  
27  #######################################
28  # proc set_ld_library_path_env_vars { }
29 @@ -42,6 +42,7 @@ proc set_ld_library_path_env_vars { } {
30    global orig_ld_library_path_32_saved
31    global orig_ld_library_path_64_saved
32    global orig_dyld_library_path_saved
33 +  global orig_path_saved
34    global orig_ld_library_path
35    global orig_ld_run_path
36    global orig_shlib_path
37 @@ -50,6 +51,7 @@ proc set_ld_library_path_env_vars { } {
38    global orig_ld_library_path_32
39    global orig_ld_library_path_64
40    global orig_dyld_library_path
41 +  global orig_path
42    global GCC_EXEC_PREFIX
43  
44    # Set the relocated compiler prefix, but only if the user hasn't specified one.
45 @@ -100,6 +102,10 @@ proc set_ld_library_path_env_vars { } {
46        set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)"
47        set orig_dyld_library_path_saved 1
48      }
49 +    if [info exists env(PATH)] {
50 +      set orig_path "$env(PATH)"
51 +      set orig_path_saved 1
52 +    }
53    }
54  
55    # We need to set ld library path in the environment.  Currently,
56 @@ -169,6 +175,13 @@ proc set_ld_library_path_env_vars { } {
57    } else {
58      setenv DYLD_LIBRARY_PATH "$ld_library_path"
59    }
60 +  if { [istarget *-*-cygwin*] || [istarget *-*-mingw*] } {
61 +    if { $orig_path_saved } {
62 +      setenv PATH "$ld_library_path:$orig_path"
63 +    } else {
64 +      setenv PATH "$ld_library_path"
65 +    }
66 +  }
67  
68    verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path"
69  }
70 @@ -187,6 +200,7 @@ proc restore_ld_library_path_env_vars {
71    global orig_ld_library_path_32_saved
72    global orig_ld_library_path_64_saved
73    global orig_dyld_library_path_saved
74 +  global orig_path_saved
75    global orig_ld_library_path
76    global orig_ld_run_path
77    global orig_shlib_path
78 @@ -195,6 +209,7 @@ proc restore_ld_library_path_env_vars {
79    global orig_ld_library_path_32
80    global orig_ld_library_path_64
81    global orig_dyld_library_path
82 +  global orig_path
83  
84    if { $orig_environment_saved == 0 } {
85      return
86 @@ -240,6 +255,11 @@ proc restore_ld_library_path_env_vars {
87    } elseif [info exists env(DYLD_LIBRARY_PATH)] {
88      unsetenv DYLD_LIBRARY_PATH
89    }
90 +  if { $orig_path_saved } {
91 +    setenv PATH "$orig_path"
92 +  } elseif [info exists env(PATH)] {
93 +    unsetenv PATH
94 +  }
95  }
96  
97  #######################################