File: randdisable

package info (click to toggle)
mysql-8.0 8.0.43-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,904 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,184; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,196; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (78 lines) | stat: -rwxr-xr-x 2,003 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env perl
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
#
# SPDX-License-Identifier: curl
#
# This script makes a "random" build using configure and verifies that it
# builds curl correctly. It randomly adds a number of the available
# --disable-* flags to configure. When it detects a problem the script stops,
# otherwise it continues trying more combinations.
#
# 1. Figure out all existing configure --disable-* options
# 2. Generate random command line using supported options + random TLS
# 3. Run configure (exit if problem)
# 4. run "make -sj10" to build (exit if problem)
# 5. run curl -V (exit if problem)
# 6. GOTO 2
#
# Tips:
#
# - edit the @tls array to include all TLS backends you can build with
# - do a checkout in a ram-based filesystem
#
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();

# options to select a TLS
my @tls = ("--with-openssl",
           "--with-wolfssl=/home/daniel/build-wolfssl",
           "--with-gnutls",
           "--with-mbedtls");

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;
        }
    }

    my @stls = shuffle @tls;
    $arg.= " ".$stls[0];

    system("make clean");
    if(system("./configure $arg")) {
        print STDERR "configure problem\n";
        print STDERR "./configure $arg\n";
        exit 1;
    }
    if(system("make -sj10")) {
        print STDERR "Build problem\n";
        print STDERR "./configure $arg\n";
        exit 1;
    }
    if(system("./src/curl -V 2>/dev/null")) {
        print STDERR "Running problem\n";
        print STDERR "./configure $arg\n";
        exit 1;
    }
} while(1);