Last active
April 3, 2025 09:42
-
-
Save bagder/80e47a6492ae416bc81204bc59633209 to your computer and use it in GitHub Desktop.
Script that generates and run a curl configure with a random set of --disable options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# Copyright (C) Daniel Stenberg, <[email protected]>, et al. | |
# | |
# SPDX-License-Identifier: curl | |
# | |
# 1. Figure out all existing configure --disable-* options | |
# 2. Generate random command line using supported options | |
# 3. Run configure (exit if problem) | |
# 4. run "b" to build (exit if problem) | |
# 5. sleep a second | |
# 7. GOTO 2 | |
use List::Util qw/shuffle/; | |
sub getoptions { | |
my @all = `./configure --help`; | |
for my $o (@all) { | |
chomp $o; | |
if($o =~ /(--disable-[^ ]*)/) { | |
if($1 !~ /FEATURE/) { | |
push @disable, $1; | |
} | |
} | |
} | |
} | |
getoptions(); | |
do { | |
# get a random number of disable options | |
my $num = rand(scalar(@disable) - 2) + 2; | |
my $c = 0; | |
my $arg; | |
for my $d (shuffle @disable) { | |
$arg .= " $d"; | |
if(++$c >= $num) { | |
last; | |
} | |
} | |
# for now | |
$arg.= " --with-openssl"; | |
print "./configure $arg\n"; | |
if(system("./configure $arg")) { | |
print STDERR "configure problem\n"; | |
print STDERR "./configure $arg\n"; | |
exit 1; | |
} | |
if(system("b")) { | |
print STDERR "Build problem\n"; | |
print STDERR "./configure $arg\n"; | |
exit 1; | |
} | |
sleep (1); | |
system("make clean"); | |
} while(1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment