Annotation of embedaddon/curl/tests/libtest/test1022.pl, revision 1.1.1.1

1.1       misho       1: #!/usr/bin/env perl
                      2: #***************************************************************************
                      3: #                                  _   _ ____  _
                      4: #  Project                     ___| | | |  _ \| |
                      5: #                             / __| | | | |_) | |
                      6: #                            | (__| |_| |  _ <| |___
                      7: #                             \___|\___/|_| \_\_____|
                      8: #
                      9: # Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
                     10: #
                     11: # This software is licensed as described in the file COPYING, which
                     12: # you should have received as part of this distribution. The terms
                     13: # are also available at https://curl.haxx.se/docs/copyright.html.
                     14: #
                     15: # You may opt to use, copy, modify, merge, publish, distribute and/or sell
                     16: # copies of the Software, and permit persons to whom the Software is
                     17: # furnished to do so, under the terms of the COPYING file.
                     18: #
                     19: # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
                     20: # KIND, either express or implied.
                     21: #
                     22: ###########################################################################
                     23: # Determine if curl-config --version matches the curl --version
                     24: if ( $#ARGV != 2 )
                     25: {
                     26:     print "Usage: $0 curl-config-script curl-version-output-file version|vernum\n";
                     27:     exit 3;
                     28: }
                     29: 
                     30: my $what=$ARGV[2];
                     31: 
                     32: # Read the output of curl --version
                     33: open(CURL, "$ARGV[1]") || die "Can't open curl --version list in $ARGV[1]\n";
                     34: $_ = <CURL>;
                     35: chomp;
                     36: /libcurl\/([\.\d]+((-DEV)|(-\d+))?)/;
                     37: my $version = $1;
                     38: close CURL;
                     39: 
                     40: my $curlconfigversion;
                     41: 
                     42: # Read the output of curl-config --version/--vernum
                     43: open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config --$what list\n";
                     44: $_ = <CURLCONFIG>;
                     45: chomp;
                     46: my $filever=$_;
                     47: if ( $what eq "version" ) {
                     48:     if($filever =~ /^libcurl ([\.\d]+((-DEV)|(-\d+))?)$/) {
                     49:         $curlconfigversion = $1;
                     50:     }
                     51:     else {
                     52:         $curlconfigversion = "illegal value";
                     53:     }
                     54: }
                     55: else { # "vernum" case
                     56:     # Convert hex version to decimal for comparison's sake
                     57:     if($filever =~ /^(..)(..)(..)$/) {
                     58:         $curlconfigversion = hex($1) . "." . hex($2) . "." . hex($3);
                     59:     }
                     60:     else {
                     61:         $curlconfigversion = "illegal value";
                     62:     }
                     63: 
                     64:     # Strip off the -DEV from the curl version if it's there
                     65:     $version =~ s/-\w*$//;
                     66: }
                     67: close CURLCONFIG;
                     68: 
                     69: my $different = $version ne $curlconfigversion;
                     70: if ($different || !$version) {
                     71:     print "Mismatch in --version:\n";
                     72:     print "curl:        $version\n";
                     73:     print "curl-config: $curlconfigversion\n";
                     74:     exit 1;
                     75: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>