@@ -12,6 +12,8 @@ use common::Config;
1212use common;
1313use util;
1414
15+ use std:: from_str:: FromStr ;
16+
1517pub struct TestProps {
1618 // Lines that should be expected, in order, on standard out
1719 pub error_patterns : Vec < String > ,
@@ -142,23 +144,42 @@ pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool {
142144 format ! ( "ignore-{}" ,
143145 config. stage_id. as_slice( ) . split( '-' ) . next( ) . unwrap( ) )
144146 }
147+ fn ignore_gdb ( config : & Config , line : & str ) -> bool {
148+ if config. mode != common:: DebugInfoGdb {
149+ return false ;
150+ }
145151
146- let val = iter_header ( testfile, |ln| {
147- if parse_name_directive ( ln, "ignore-test" ) {
148- false
149- } else if parse_name_directive ( ln, ignore_target ( config) . as_slice ( ) ) {
150- false
151- } else if parse_name_directive ( ln, ignore_stage ( config) . as_slice ( ) ) {
152- false
153- } else if config. mode == common:: Pretty &&
154- parse_name_directive ( ln, "ignore-pretty" ) {
155- false
156- } else if config. target != config. host &&
157- parse_name_directive ( ln, "ignore-cross-compile" ) {
158- false
159- } else {
160- true
152+ if parse_name_directive ( line, "ignore-gdb" ) {
153+ return true ;
161154 }
155+
156+ match config. gdb_version {
157+ Some ( ref actual_version) => {
158+ if line. contains ( "min-gdb-version" ) {
159+ let min_version = line. trim ( )
160+ . split ( ' ' )
161+ . last ( )
162+ . expect ( "Malformed GDB version directive" ) ;
163+ // Ignore if actual version is smaller the minimum required
164+ // version
165+ gdb_version_to_int ( actual_version. as_slice ( ) ) <
166+ gdb_version_to_int ( min_version. as_slice ( ) )
167+ } else {
168+ false
169+ }
170+ }
171+ None => false
172+ }
173+ }
174+
175+ let val = iter_header ( testfile, |ln| {
176+ !parse_name_directive ( ln, "ignore-test" ) &&
177+ !parse_name_directive ( ln, ignore_target ( config) . as_slice ( ) ) &&
178+ !parse_name_directive ( ln, ignore_stage ( config) . as_slice ( ) ) &&
179+ !( config. mode == common:: Pretty && parse_name_directive ( ln, "ignore-pretty" ) ) &&
180+ !( config. target != config. host && parse_name_directive ( ln, "ignore-cross-compile" ) ) &&
181+ !ignore_gdb ( config, ln) &&
182+ !( config. mode == common:: DebugInfoLldb && parse_name_directive ( ln, "ignore-lldb" ) )
162183 } ) ;
163184
164185 !val
@@ -278,3 +299,21 @@ pub fn parse_name_value_directive(line: &str, directive: &str)
278299 None => None
279300 }
280301}
302+
303+ pub fn gdb_version_to_int ( version_string : & str ) -> int {
304+ let error_string = format ! (
305+ "Encountered GDB version string with unexpected format: {}" ,
306+ version_string) ;
307+ let error_string = error_string. as_slice ( ) ;
308+
309+ let components: Vec < & str > = version_string. trim ( ) . split ( '.' ) . collect ( ) ;
310+
311+ if components. len ( ) != 2 {
312+ fail ! ( "{}" , error_string) ;
313+ }
314+
315+ let major: int = FromStr :: from_str ( components[ 0 ] ) . expect ( error_string) ;
316+ let minor: int = FromStr :: from_str ( components[ 1 ] ) . expect ( error_string) ;
317+
318+ return major * 1000 + minor;
319+ }
0 commit comments