Skip to content

Commit

Permalink
build script: Allow user to override the hostname (#149)
Browse files Browse the repository at this point in the history
This is useful when the default hostname isn't related to the name of
the HPC machine (e.g., compute notes at cori.nersc.gov are named 'nid').
  • Loading branch information
hainest committed Apr 19, 2020
1 parent 0ac7a31 commit 1403324
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion scripts/build/Dyninst/logs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,15 @@ sub get_system_info {
}

sub save_system_info {
my ($logger) = @_;
my ($logger, $hostname) = @_;

my $sysinfo = get_system_info();

# Allow user to override the hostname
if(defined $hostname) {
$sysinfo->{'nodename'} = $hostname;
}

$logger->write(
"os: $sysinfo->{'sysname'}\n" .
"hostname: $sysinfo->{'nodename'}\n" .
Expand Down
6 changes: 4 additions & 2 deletions scripts/build/build.pl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
'single-stepping' => 0,
'auth-token' => undef,
'sterile' => 1,
'hostname' => undef,
'debug-mode' => 0 # undocumented debug mode
);

Expand All @@ -55,7 +56,7 @@
'run-tests!', 'tests!', 'njobs=i', 'quiet', 'purge',
'help', 'restart=s', 'upload!', 'ntestjobs=i',
'nompthreads=i', 'single-stepping', 'auth-token=s',
'sterile!', 'debug-mode'
'sterile!', 'hostname=s', 'debug-mode'
) or pod2usage(-exitval=>2);

if($args{'help'}) {
Expand Down Expand Up @@ -139,7 +140,7 @@
print Dumper(\%args), "\n";
}

Dyninst::logs::save_system_info($logger);
Dyninst::logs::save_system_info($logger, $args{'hostname'});

# Generate a unique name for the current build
$root_dir = tempdir('XXXXXXXX', CLEANUP=>0) unless $args{'restart'};
Expand Down Expand Up @@ -313,5 +314,6 @@ =head1 SYNOPSIS
--single-stepping Run the tests one at a time (i.e., not in 'group' mode) (default: no)
--auth-token=STRING The authentication token string. Required when uploading the results.
--[no-]sterile Use a sterile build- don't download dependencies (default: yes)
--hostname Override the hostname provided by `uname`
--help Print this help message
=cut

0 comments on commit 1403324

Please sign in to comment.