From ce1649564c3dc5efc0d8958f77d9cbc6fb2f742d Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Fri, 8 Feb 2008 01:21:03 +0000 Subject: Added tests 1022 and 1023 to validate output of curl-config --version and --vernum --- CHANGES | 4 ++++ tests/data/Makefile.am | 2 +- tests/libtest/Makefile.am | 2 +- tests/libtest/test1013.pl | 5 +++-- tests/libtest/test1022.pl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100755 tests/libtest/test1022.pl diff --git a/CHANGES b/CHANGES index 9dac29165..aff59dfef 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,10 @@ Changelog +Daniel Fandrich (7 Feb 2007) +- Added tests 1022 and 1023 to validate output of curl-config --version and + --vernum + Daniel S (7 Feb 2008) - Refactored a lot of timeout code into a few functions in an attempt to make them all use the same (hopefully correct) logic to make it less error-prone diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 7a976f9d3..826b557a6 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -48,7 +48,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \ test2000 test2001 test2002 test2003 test35 test544 test545 test2004 \ test546 test1013 test1014 test1015 test547 test548 test549 test550 \ test551 test552 test1016 test1017 test1018 test1019 test1020 test553 \ - test1021 + test1021 test1022 test1023 filecheck: @mkdir test-place; \ diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am index a808a673f..65c987d1e 100644 --- a/tests/libtest/Makefile.am +++ b/tests/libtest/Makefile.am @@ -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 diff --git a/tests/libtest/test1013.pl b/tests/libtest/test1013.pl index b46e5ae3a..6127df82a 100755 --- a/tests/libtest/test1013.pl +++ b/tests/libtest/test1013.pl @@ -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; } diff --git a/tests/libtest/test1022.pl b/tests/libtest/test1022.pl new file mode 100755 index 000000000..73bfc5fc3 --- /dev/null +++ b/tests/libtest/test1022.pl @@ -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"; +$_ = ; +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"; +$_ = ; +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; +} -- cgit v1.2.3