Skip to content

Instantly share code, notes, and snippets.

@bagder
Last active April 3, 2025 09:42
Show Gist options
  • Save bagder/80e47a6492ae416bc81204bc59633209 to your computer and use it in GitHub Desktop.
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
#!/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