Skip to content

Commit

Permalink
i#1569: AArch64 CI: add a block showing info about runner (#6767)
Browse files Browse the repository at this point in the history
This patch adds some code to the runsuite wrapper
to print critical information about the runner such as os, kernel
version and cpu.

Currently this block looks like:
```
=========== System info ===========
OS: Ubuntu 20.04.6 LTS
Kernel Version: 5.15.0-1043-aws
CPU: Neoverse V1
Clang version: Ubuntu clang version 12.0.0-3ubuntu1~20.04.5
GCC version: gcc (Ubuntu 11.4.0-2ubuntu1~20.04) 11.4.0
Features: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics... 
===================================
```
and is only shown during AArch64 runs, just before the results.

issue: #1569
  • Loading branch information
joshua-warburton committed Apr 15, 2024
1 parent c69c151 commit 6af99e9
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions suite/runsuite_wrapper.pl
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,66 @@
};
}

if ($is_aarchxx) {

my $cpuinfo = '/proc/cpuinfo';
my $osfile = '/etc/os-release';

sub extract {
my ($file, $filter, $delim) = @_;
my $line;
if (open my $handle, '<', "$file") {
while (<$handle>) {
if (/$filter/) {
chomp ($line = (split $delim)[1]);
$line =~ s/ ^\s+ | \s+$ | \"//gx; # Strip spaces and "
close $handle;
return $line;
}
}
close $handle;
} else {
print "Failed to open file ${file}: $!\n";
}
return 'unknown';
}

sub first_line_or {
my ($command, $or) = @_;
my $stdout = `${command}`;

if ($? == 0) {
chomp($stdout = (split '\n', $stdout)[0]);
return $stdout;
}
return $or;
}

my $cpu_part = extract($cpuinfo, qr/\bCPU part\b/, ':');
my $features = extract($cpuinfo, qr/\bFeatures\b/, ':');
my $os_name = extract($osfile, qr/\bPRETTY_NAME\b/, '=');
my $clang_version = first_line_or('clang --version', 'none');
my $gcc_version = first_line_or('gcc --version', 'none');
my $kernel_version = first_line_or('uname -r', 'unknown');

my %cpu_parts = (
'0xd40' => 'Neoverse V1', '0xd4f' => 'Neoverse V2', '0xd0c' => 'Neoverse N1',
'0xd49' => 'Neoverse N2', '0xd08' => 'Cortex-A72', '0xd46' => 'Cortex-A510',
'0xd47' => 'Cortex-A710', 'unknown' => 'unknown',);
my $cpu_name = $cpu_parts{$cpu_part} // "unknown(${cpu_part})";

print "=========== System info ===========\n";
print "OS: ${os_name}\n";
print "Kernel Version: ${kernel_version}\n";
print "CPU: ${cpu_name}\n";
print "Clang version: ${clang_version}\n";
print "GCC version: ${gcc_version}\n";
print "Features: ${features}\n";
print "===================================\n\n";
print "===================================\n\n";
}


my @lines = split('\n', $res);
my $should_print = 0;
my $exit_code = 0;
Expand Down

0 comments on commit 6af99e9

Please sign in to comment.