Skip to content

Commit 4f73d21

Browse files
committed
Fix compiletest on FreeBSD
Recent FreeBSD gdb packages have a different format for the version string.
1 parent 52e3dff commit 4f73d21

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/tools/compiletest/src/main.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,8 @@ fn extract_gdb_version(full_version_line: &str) -> Option<u32> {
909909
// This particular form is documented in the GNU coding standards:
910910
// https://www.gnu.org/prep/standards/html_node/_002d_002dversion.html#g_t_002d_002dversion
911911

912-
let mut splits = full_version_line.rsplit(' ');
912+
let unbracketed_part = full_version_line.split('[').next().unwrap();
913+
let mut splits = unbracketed_part.trim_end().rsplit(' ');
913914
let version_string = splits.next().unwrap();
914915

915916
let mut splits = version_string.split('.');

src/tools/compiletest/src/tests.rs

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ fn test_extract_gdb_version() {
3939
7012000: "GNU gdb (GDB) 7.12",
4040
7012000: "GNU gdb (GDB) 7.12.20161027-git",
4141
7012050: "GNU gdb (GDB) 7.12.50.20161027-git",
42+
43+
9002000: "GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2",
44+
10001000: "GNU gdb (GDB) 10.1 [GDB v10.1 for FreeBSD]",
4245
}
4346
}
4447

0 commit comments

Comments
 (0)