From dfe476915711628478be22fb39452c8eddc607ae Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Wed, 2 Jan 2013 20:12:15 +0100 Subject: build and tests: curl_10char_object_name() shell function lib/objnames.inc provides definition of curl_10char_object_name() shell function. The intended purpose of this function is to transliterate a (*.c) source file name that may be longer than 10 characters, or not, into a string with at most 10 characters which may be used as an OS/400 object name. Test case 1221 does unit testng of this function and also verifies that it is possible to generate distinct short object names for all curl and libcurl *.c source file names. lib/objnames-test.sh is the shell script used for test case 1221. tests/runtests.pl modified to accept shell script test cases. More details inside lib/objnames.inc and lib/objnames-test.sh --- tests/data/Makefile.am | 2 +- tests/data/test1221 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tests/runtests.pl | 7 +++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/data/test1221 (limited to 'tests') diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index 5701eb5f2..aaa75e915 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -78,7 +78,7 @@ test1118 test1119 test1120 test1121 test1122 test1123 test1124 test1125 \ test1126 test1127 test1128 test1129 test1130 test1131 test1132 \ test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \ test1208 test1209 test1210 test1211 \ -test1220 \ +test1220 test1221 \ test1300 test1301 test1302 test1303 test1304 test1305 \ test1306 test1307 test1308 test1309 test1310 test1311 test1312 test1313 \ test1314 test1315 test1316 test1317 test1318 test1319 test1320 test1321 \ diff --git a/tests/data/test1221 b/tests/data/test1221 new file mode 100644 index 000000000..26d06108d --- /dev/null +++ b/tests/data/test1221 @@ -0,0 +1,46 @@ + +# +# Client-side + + +none + + + +10 chars object name generation testing + + +%SRCDIR/../lib/objnames-test.sh %SRCDIR + + + +# +# Verify data after the test has been "shot" + + + + +Testing curl_10char_object_name... + +result: 16AFKPQRST expected: 16AFKPQRST input: 123__678__ABC__FGH__KLM__PQRSTUV +result: 16AFKPQ expected: 16AFKPQ input: 123__678__ABC__FGH__KLM__PQ.S.UV +result: 16ABC expected: 16ABC input: 123__678__ABC..FGH..KLM..PQRSTUV +result: 16 expected: 16 input: 123__678_.ABC._FGH__KLM__PQRSTUV +result: 123 expected: 123 input: 123.567.90ABCDEFGHIJKLMNOPQRSTUV +result: 1234567 expected: 1234567 input: 1234567.90A.CDEFGHIJKLMNOPQRSTUV +result: 1234567890 expected: 1234567890 input: 1234567890.BCD.FGHIJKLMNOPQRSTUV +result: 1470AB expected: 1470AB input: 12=45-78+0AB.DE.GHIJKLMNOPQRSTUV +result: 1234567890 expected: 1234567890 input: 1234567890ABCDEFGHIJKLMNOPQRSTUV +result: 159CGHIJKL expected: 159CGHIJKL input: 123_567_90A_CDE_GHIJKLMNOPQRSTUV +result: 159CDEFGHI expected: 159CDEFGHI input: 123_567_90A_CDEFGHIJKLMNOPQRSTUV +result: 1590ABCDEF expected: 1590ABCDEF input: 123_567_90ABCDEFGHIJKLMNOPQRSTUV +result: 1567890ABC expected: 1567890ABC input: 123_567890ABCDEFGHIJKLMNOPQRSTUV +result: 1234567890 expected: 1234567890 input: 1234567890ABCDEFGHIJKLMNOPQRSTUV + + + +10-characters-or-less generated object names are unique. + + + + diff --git a/tests/runtests.pl b/tests/runtests.pl index 210fb73e2..f6c2016c4 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -3026,6 +3026,13 @@ sub singletest { $tool=$CMDLINE; $disablevalgrind=1; } + elsif($cmdtype eq "shell") { + # run the command line prepended with "/bin/sh" + $cmdargs ="$cmd"; + $CMDLINE = "/bin/sh "; + $tool=$CMDLINE; + $disablevalgrind=1; + } elsif(!$tool) { # run curl, add --verbose for debug information output $cmd = "-1 ".$cmd if(exists $feature{"SSL"} && ($has_axtls)); -- cgit v1.2.3