Skip to content

Commit

Permalink
improve error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
tonycoz committed May 7, 2024
1 parent 31f622b commit de470c7
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions t/porting/cpphdrcheck.t
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,14 @@ sub ok_compile_only($job, $conf, $name) {
local $Level = $Level + 1;
my $result = _test_compile_only($job, $conf);

ok($result, $name);
if (ok($result->{ok}, $name)) {
note "cmd: $result->{cmd}";
note "out: $result->{out}";
}
else {
diag "cmd: $result->{cmd}";
diag "out: $result->{out}";
}
}

sub _test_compile_only ($job, $conf) {
Expand All @@ -241,18 +248,22 @@ sub _test_compile_only ($job, $conf) {
}

my $cmd = "$conf->{ccpp} $opts $code 2>&1";
note "running '$cmd'";
my $out = `$cmd`;

chdir $cwd;

unless ($? == 0) {
note "'$cmd' failed: $out";
return;
return
+{
cmd => $cmd,
out => $out,
};
}

return
+{
ok => 1,
cmd => $cmd,
out => $out,
};
}
Expand Down Expand Up @@ -336,7 +347,13 @@ sub get_source ($keyword) {
}

# the test code below tries to use at least one language feature
# specific to that version
# specific to that version.
#
# For now we don't try to do anything real with perl here, but that may change.
#
# The perl headers need to be after the C++ headers since the perl headers
# define many macros that could conflict with the public and non-public
# like "std::__impl::somenamehere" names that the C++ headers use or define
__DATA__
-- cpp11
#include <iostream>
Expand Down

0 comments on commit de470c7

Please sign in to comment.