mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-30 07:14:09 +08:00
libphobos: Skip curl tests if libcurl is not installed on the target.
libphobos/ChangeLog: 2019-04-24 Iain Buclaw <ibuclaw@gdcproject.org> PR d/88654 * testsuite/lib/libphobos.exp (libphobos-dg-test): Check libphobos_skipped_test_p before running test. (libphobos-dg-prune): New proc. (libphobos_init): Set libphobos_skip_tests. (libphobos_skipped_test_p): New proc. (check_effective_target_libcurl_available): New proc. * testsuite/libphobos.phobos/phobos.exp: Skip curl tests if library not found. * testsuite/libphobos.phobos_shared/phobos_shared.exp: Likewise. From-SVN: r270545
This commit is contained in:
parent
9fe1940081
commit
540bc8a8b1
@ -1,3 +1,16 @@
|
||||
2019-04-24 Iain Buclaw <ibuclaw@gdcproject.org>
|
||||
|
||||
PR d/88654
|
||||
* testsuite/lib/libphobos.exp (libphobos-dg-test): Check
|
||||
libphobos_skipped_test_p before running test.
|
||||
(libphobos-dg-prune): New proc.
|
||||
(libphobos_init): Set libphobos_skip_tests.
|
||||
(libphobos_skipped_test_p): New proc.
|
||||
(check_effective_target_libcurl_available): New proc.
|
||||
* testsuite/libphobos.phobos/phobos.exp: Skip curl tests if library
|
||||
not found.
|
||||
* testsuite/libphobos.phobos_shared/phobos_shared.exp: Likewise.
|
||||
|
||||
2019-04-24 Iain Buclaw <ibuclaw@gdcproject.org>
|
||||
|
||||
PR d/88431
|
||||
|
@ -47,8 +47,8 @@ proc libphobos-dg-test { prog do_what extra_tool_flags } {
|
||||
set output_file ""
|
||||
|
||||
global libphobos_test_name
|
||||
upvar name name
|
||||
if { $libphobos_test_name != "" } {
|
||||
upvar name name
|
||||
set name $libphobos_test_name
|
||||
}
|
||||
|
||||
@ -80,11 +80,19 @@ proc libphobos-dg-test { prog do_what extra_tool_flags } {
|
||||
lappend options "additional_flags=$extra_tool_flags"
|
||||
}
|
||||
|
||||
set comp_output [$select_compile "$prog" "$output_file" "$compile_type" $options]
|
||||
set unsupported_message [libphobos_skipped_test_p $name]
|
||||
if { $unsupported_message != "" } {
|
||||
return [list "::unsupported::$unsupported_message" $output_file]
|
||||
}
|
||||
|
||||
set comp_output [$select_compile "$prog" "$output_file" "$compile_type" $options]
|
||||
return [list $comp_output $output_file]
|
||||
}
|
||||
|
||||
proc libphobos-dg-prune { system text } {
|
||||
return $text
|
||||
}
|
||||
|
||||
#
|
||||
# libphobos_init
|
||||
#
|
||||
@ -120,6 +128,9 @@ proc libphobos_init { args } {
|
||||
global libphobos_test_name
|
||||
set libphobos_test_name ""
|
||||
|
||||
global libphobos_skip_tests
|
||||
set libphobos_skip_tests { }
|
||||
|
||||
# Default settings.
|
||||
set blddir [lookfor_file [get_multilibs] libphobos]
|
||||
set flags_file "${blddir}/testsuite/testsuite_flags"
|
||||
@ -143,7 +154,7 @@ proc libphobos_init { args } {
|
||||
}
|
||||
|
||||
# Compute what needs to be added to the existing LD_LIBRARY_PATH.
|
||||
set ld_library_path ""
|
||||
set ld_library_path "."
|
||||
|
||||
set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
|
||||
if {$gccdir != ""} {
|
||||
@ -218,3 +229,35 @@ proc filter_libphobos_unittests { list } {
|
||||
}
|
||||
return $res
|
||||
}
|
||||
|
||||
# Skip the unittest (report it as UNSUPPORTED) if the module exists in
|
||||
# libphobos_skip_tests and its target list is matched by dg-process-target.
|
||||
#
|
||||
# The expected format of the libphobos_skip_tests file is:
|
||||
# { test { targets } }
|
||||
proc libphobos_skipped_test_p { test } {
|
||||
global libphobos_skip_tests
|
||||
|
||||
set row [lsearch -inline -index 0 $libphobos_skip_tests $test]
|
||||
if { $row eq "" } {
|
||||
return ""
|
||||
}
|
||||
|
||||
if { [llength $row] != 2 } {
|
||||
error "syntax error in libphobos_skip_tests: $row"
|
||||
}
|
||||
|
||||
set selector [list target [lindex $row 1]]
|
||||
if { [dg-process-target-1 $selector] != "S" } {
|
||||
return ""
|
||||
}
|
||||
|
||||
return "skipped test"
|
||||
}
|
||||
|
||||
# Return true if the curl library is supported on the target.
|
||||
proc check_effective_target_libcurl_available { } {
|
||||
return [check_no_compiler_messages libcurl_available executable {
|
||||
int main (void) { return 0; }
|
||||
} "-lcurl"]
|
||||
}
|
||||
|
@ -22,6 +22,12 @@ if { ![isnative] || ![is-effective-target static] } {
|
||||
# Gather a list of all tests.
|
||||
set tests [lsort [filter_libphobos_unittests [find $srcdir/../src "*.d"]]]
|
||||
|
||||
set libphobos_skip_tests {
|
||||
# Skip curl tests if library is not available
|
||||
{ libphobos.phobos/etc/c/curl.d { ! libcurl_available } }
|
||||
{ libphobos.phobos/std/net/curl.d { ! libcurl_available } }
|
||||
}
|
||||
|
||||
# Initialize dg.
|
||||
dg-init
|
||||
|
||||
|
@ -22,6 +22,12 @@ if { ![isnative] || ![is-effective-target shared] } {
|
||||
# Gather a list of all tests.
|
||||
set tests [lsort [filter_libphobos_unittests [find $srcdir/../src "*.d"]]]
|
||||
|
||||
set libphobos_skip_tests {
|
||||
# Skip curl tests if library is not available
|
||||
{ libphobos.phobos_shared/etc/c/curl.d { ! libcurl_available } }
|
||||
{ libphobos.phobos_shared/std/net/curl.d { ! libcurl_available } }
|
||||
}
|
||||
|
||||
# Initialize dg.
|
||||
dg-init
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user