[SV 63037] Fix tests for newer OS / compiler

* tests/scripts/features/load: Add function prototypes.
* tests/scripts/features/temp_stdin: Only set user execute bits.
Some configurations don't allow changing the group bits...??
This commit is contained in:
Paul Smith 2022-09-10 17:15:23 -04:00
parent 70ba0357a0
commit a9548aeb8f
2 changed files with 12 additions and 9 deletions

View file

@ -4,7 +4,7 @@ $description = "Test the load operator.";
$details = "Test dynamic loading of modules."; $details = "Test dynamic loading of modules.";
# Don't do anything if this system doesn't support "load" # Don't do anything if this system doesn't support "load"
exists $FEATURES{load} or return -1; exists $FEATURES{'load'} or return -1;
my $cc = get_config('CC'); my $cc = get_config('CC');
if (! $cc) { if (! $cc) {
@ -26,6 +26,9 @@ print $F <<'EOF' ;
int plugin_is_GPL_compatible; int plugin_is_GPL_compatible;
int testload_gmk_setup (gmk_floc *);
int explicit_setup (gmk_floc *);
int int
testload_gmk_setup (gmk_floc *pos) testload_gmk_setup (gmk_floc *pos)
{ {
@ -46,14 +49,14 @@ close($F) or die "close: testload.c: $!\n";
# Make sure we can compile # Make sure we can compile
my $cflags = get_config('CFLAGS'); my $cppflags = get_config('CPPFLAGS') . ($srcdir ? " -I$srcdir/src" : '');
my $cppflags = get_config('CPPFLAGS'); my $cflags = get_config('CFLAGS') . ' -fPIC';
my $ldflags = get_config('LDFLAGS'); my $ldflags = get_config('LDFLAGS') . ' -shared';
my $sobuild = "$cc ".($srcdir? "-I$srcdir/src":'')." $cppflags $cflags -shared -fPIC $ldflags -o testload.so testload.c"; my $sobuild = "$cc $cppflags $cflags $ldflags -o testload.so testload.c";
my $clog = `$sobuild 2>&1`; my $clog = `$sobuild 2>&1`;
if ($? != 0) { if ($? != 0) {
$verbose and print "Failed to build testload.so:\n$sobuild\n$_"; $verbose and print "Failed to build testload.so:\n$sobuild\n$clog";
return -1; return -1;
} }

View file

@ -56,7 +56,7 @@ use File::Copy;
my $makecopy = File::Spec->catfile($TEMPDIR, "make"); my $makecopy = File::Spec->catfile($TEMPDIR, "make");
copy("$mkpath", $makecopy); copy("$mkpath", $makecopy);
# Set file mode bits, because perl copy won't. # Set file mode bits, because perl copy won't.
chmod 0750, $makecopy; chmod 0700, $makecopy;
my @make_orig = @make_command; my @make_orig = @make_command;
@make_command = ($makecopy); @make_command = ($makecopy);
@ -68,10 +68,10 @@ open(STDIN, "<", 'input.mk') || die "$0: cannot open input.mk for reading: $!";
run_make_test(" run_make_test("
include bye.mk include bye.mk
all:; \$(info hello) all:; \$(info hello)
\$(MAKE_RESTARTS)bye.mk: force; touch \$@ && chmod -x $makecopy \$(MAKE_RESTARTS)bye.mk: force; touch \$@ && chmod u-x $makecopy
force: force:
", ",
"-f-", "touch bye.mk && chmod -x $makecopy\nmake: $makecopy: $ERR_nonexe_file\n", 32512); "-f-", "touch bye.mk && chmod u-x $makecopy\nmake: $makecopy: $ERR_nonexe_file\n", 32512);
@make_command = @make_orig; @make_command = @make_orig;
unlink($makecopy); unlink($makecopy);