Added tests 1022 and 1023 to validate output of curl-config --version and

--vernum
This commit is contained in:
Dan Fandrich 2008-02-08 01:21:03 +00:00
parent d76a74cc5e
commit ce1649564c
5 changed files with 54 additions and 4 deletions

View file

@ -35,7 +35,7 @@ INCLUDES = -I$(top_srcdir)/include/curl \
LIBDIR = $(top_builddir)/lib
EXTRA_DIST = test75.pl test307.pl test610.pl test613.pl test1013.pl
EXTRA_DIST = test75.pl test307.pl test610.pl test613.pl test1013.pl test1022.pl
# files used only in some libcurl test programs
TESTUTIL = testutil.c testutil.h

View file

@ -1,8 +1,9 @@
#!/usr/bin/env perl
# Determine if curl-config --protocols matches the curl --version protocols
# Determine if curl-config --protocols/--features matches the
# curl --version protocols/features
if ( $#ARGV != 2 )
{
print "Usage: $0 curl-config-script curl-features-file features|protocols\n";
print "Usage: $0 curl-config-script curl-version-output-file features|protocols\n";
exit 3;
}

45
tests/libtest/test1022.pl Executable file
View file

@ -0,0 +1,45 @@
#!/usr/bin/env perl
# Determine if curl-config --version matches the curl --version
if ( $#ARGV != 2 )
{
print "Usage: $0 curl-config-script curl-version-output-file version|vernum\n";
exit 3;
}
my $what=$ARGV[2];
# Read the output of curl --version
open(CURL, "$ARGV[1]") || die "Can't open curl --version list in $ARGV[1]\n";
$_ = <CURL>;
chomp;
/libcurl\/([\.\d]+(-CVS)?)/;
my $version = $1;
close CURL;
my $curlconfigversion;
# Read the output of curl-config --version/--vernum
open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config --$what list\n";
$_ = <CURLCONFIG>;
chomp;
if ( $what eq "version" ) {
/^libcurl ([\.\d]+(-CVS)?)$/ ;
$curlconfigversion = $1;
}
else {
# Convert hex version to decimal for comparison's sake
/^([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})$/ ;
$curlconfigversion = hex($1) . "." . hex($2) . "." . hex($3);
# Strip off the -CVS from the curl version if it's there
$version =~ s/-CVS$//;
}
close CURLCONFIG;
my $different = $version ne $curlconfigversion;
if ($different || !$version) {
print "Mismatch in --version:\n";
print "curl: $version\n";
print "curl-config: $curlconfigversion\n";
exit 1;
}