test122[12]: remove these two tests

... and remove the objnames scripts they tested. They're not used for
anything anymore so testing them serves no purpose!

Reported-by: Marc Hörsken
Fixes #6080
Closes #6081
This commit is contained in:
Daniel Stenberg 2020-10-14 23:49:00 +02:00
parent 315ee3fe75
commit 15997f6db5
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
8 changed files with 2 additions and 650 deletions

2
lib/.gitattributes vendored
View File

@ -1 +1 @@
objnames.inc eol=lf

View File

@ -31,7 +31,6 @@ EXTRA_DIST = ftpserver.pl httpserver.pl secureserver.pl runtests.pl \
CMakeLists.txt mem-include-scan.pl valgrind.supp extern-scan.pl \
manpage-scan.pl nroff-scan.pl http2-server.pl dictserver.py \
negtelnetserver.py smbserver.py curl_test_data.py \
objnames-test08.sh objnames-test10.sh objnames.inc \
disable-scan.pl manpage-syntax.pl error-codes.pl badsymbols.pl \
azure.pm appveyor.pm version-scan.pl options-scan.pl

View File

@ -143,7 +143,7 @@ test1190 test1191 test1192 test1193 test1194 test1195 test1196 test1197 \
\
test1200 test1201 test1202 test1203 test1204 test1205 test1206 test1207 \
test1208 test1209 test1210 test1211 test1212 test1213 test1214 test1215 \
test1216 test1217 test1218 test1219 test1220 test1221 test1222 test1223 \
test1216 test1217 test1218 test1219 test1220 test1223 \
test1224 test1225 test1226 test1227 test1228 test1229 test1230 test1231 \
test1232 test1233 test1234 test1235 test1236 test1237 test1238 test1239 \
test1240 test1241 test1242 test1243 test1244 test1245 test1246 test1247 \

View File

@ -1,53 +0,0 @@
<testcase>
<info>
<keywords>
build system
source analysis
</keywords>
</info>
#
# Client-side
<client>
<server>
none
</server>
<name>
10 chars object name generation testing
</name>
<command option="no-output,no-include" type="shell">
%SRCDIR/objnames-test10.sh %SRCDIR
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<file1 name="log/stderr1221" mode="text">
</file1>
<file2 name="log/stdout1221">
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.
</file2>
</verify>
</testcase>

View File

@ -1,53 +0,0 @@
<testcase>
<info>
<keywords>
build system
source analysis
</keywords>
</info>
#
# Client-side
<client>
<server>
none
</server>
<name>
8 chars object name generation testing
</name>
<command option="no-output,no-include" type="shell">
%SRCDIR/objnames-test08.sh %SRCDIR
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<file1 name="log/stderr1222">
</file1>
<file2 name="log/stdout1222">
Testing curl_8char_object_name...
result: 16AFKPQR expected: 16AFKPQR 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: 12345678 expected: 12345678 input: 1234567890.BCD.FGHIJKLMNOPQRSTUV
result: 1470AB expected: 1470AB input: 12=45-78+0AB.DE.GHIJKLMNOPQRSTUV
result: 12345678 expected: 12345678 input: 1234567890ABCDEFGHIJKLMNOPQRSTUV
result: 159CGHIJ expected: 159CGHIJ input: 123_567_90A_CDE_GHIJKLMNOPQRSTUV
result: 159CDEFG expected: 159CDEFG input: 123_567_90A_CDEFGHIJKLMNOPQRSTUV
result: 1590ABCD expected: 1590ABCD input: 123_567_90ABCDEFGHIJKLMNOPQRSTUV
result: 1567890A expected: 1567890A input: 123_567890ABCDEFGHIJKLMNOPQRSTUV
result: 12345678 expected: 12345678 input: 1234567890ABCDEFGHIJKLMNOPQRSTUV
8-characters-or-less generated object names are unique.
</file2>
</verify>
</testcase>

View File

@ -1,217 +0,0 @@
#!/bin/sh
# ***************************************************************************
# * _ _ ____ _
# * Project ___| | | | _ \| |
# * / __| | | | |_) | |
# * | (__| |_| | _ <| |___
# * \___|\___/|_| \_\_____|
# *
# * Copyright (C) 2013 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
# *
# * This software is licensed as described in the file COPYING, which
# * you should have received as part of this distribution. The terms
# * are also available at https://curl.haxx.se/docs/copyright.html.
# *
# * You may opt to use, copy, modify, merge, publish, distribute and/or sell
# * copies of the Software, and permit persons to whom the Software is
# * furnished to do so, under the terms of the COPYING file.
# *
# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# * KIND, either express or implied.
# *
# ***************************************************************************
#
# This Bourne shell script file is used by test case 1222 to do
# unit testing of curl_8char_object_name() shell function which
# is defined in file objnames.inc and sourced by this file and
# any other shell script that may use it.
#
#
# argument validation
#
if test $# -eq 1; then
:
else
echo "Usage: ${0} srcdir"
exit 1
fi
if test -f "${1}/runtests.pl"; then
:
else
echo "${0}: Wrong srcdir"
exit 1
fi
srcdir=${1}
if test -f "$srcdir/objnames.inc"; then
:
else
echo "$0: Missing objnames.inc"
exit 1
fi
#
# Some variables
#
logdir=log
tstnum=1222
list_c=$logdir/${tstnum}_list_c
list_obj=$logdir/${tstnum}_list_obj
list_obj_c=$logdir/${tstnum}_list_obj_c
list_obj_uniq=$logdir/${tstnum}_list_obj_uniq
#
# Source curl_8char_object_name() function definition
#
. $srcdir/objnames.inc
#
# Some curl_8char_object_name() unit tests
#
echo 'Testing curl_8char_object_name...'
echo ""
argstr=123__678__ABC__FGH__KLM__PQRSTUV
expect=16AFKPQR
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123__678__ABC__FGH__KLM__PQ.S.UV
expect=16AFKPQ
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123__678__ABC..FGH..KLM..PQRSTUV
expect=16ABC
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123__678_.ABC._FGH__KLM__PQRSTUV
expect=16
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123.567.90ABCDEFGHIJKLMNOPQRSTUV
expect=123
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=1234567.90A.CDEFGHIJKLMNOPQRSTUV
expect=1234567
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=1234567890.BCD.FGHIJKLMNOPQRSTUV
expect=12345678
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=12=45-78+0AB.DE.GHIJKLMNOPQRSTUV
expect=1470AB
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=1234567890ABCDEFGHIJKLMNOPQRSTUV
expect=12345678
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123_567_90A_CDE_GHIJKLMNOPQRSTUV
expect=159CGHIJ
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123_567_90A_CDEFGHIJKLMNOPQRSTUV
expect=159CDEFG
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123_567_90ABCDEFGHIJKLMNOPQRSTUV
expect=1590ABCD
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123_567890ABCDEFGHIJKLMNOPQRSTUV
expect=1567890A
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=1234567890ABCDEFGHIJKLMNOPQRSTUV
expect=12345678
outstr=`curl_8char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
#
# Verify that generated object name is distinct for
# all *.c source files in lib and src subdirectories.
#
ls $srcdir/../lib/*.c > $list_c
ls $srcdir/../src/*.c >> $list_c
rm -f $list_obj
for c_fname in `cat $list_c`; do
obj_name=`curl_8char_object_name $c_fname`
echo "$obj_name" >> $list_obj
done
sort -u $list_obj > $list_obj_uniq
cnt_c=`cat $list_c | wc -l`
cnt_u=`cat $list_obj_uniq | wc -l`
echo ""
echo ""
echo ""
if test $cnt_c -eq $cnt_u; then
echo "8-characters-or-less generated object names are unique."
obj_name_clash="no"
else
echo "8-characters-or-less generated object names are clashing..."
obj_name_clash="yes"
fi
if test $obj_name_clash = "yes"; then
#
# Show clashing object names and respective source file names
#
echo ""
paste $list_obj $list_c | sort > $list_obj_c
prev_match="no"
prev_line="unknown"
prev_obj_name="unknown"
while read this_line; do
obj_name=`echo "$this_line" | cut -f1`
if test "x$obj_name" = "x$prev_obj_name"; then
if test "x$prev_match" != "xyes"; then
echo "$prev_line"
echo "$this_line"
prev_match="yes"
else
echo "$this_line"
fi
else
prev_match="no"
fi
prev_line=$this_line
prev_obj_name=$obj_name
done < $list_obj_c
fi
rm -f $list_c
rm -f $list_obj
rm -f $list_obj_c
rm -f $list_obj_uniq
# end of objnames-test.sh

View File

@ -1,217 +0,0 @@
#!/bin/sh
# ***************************************************************************
# * _ _ ____ _
# * Project ___| | | | _ \| |
# * / __| | | | |_) | |
# * | (__| |_| | _ <| |___
# * \___|\___/|_| \_\_____|
# *
# * Copyright (C) 2013 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
# *
# * This software is licensed as described in the file COPYING, which
# * you should have received as part of this distribution. The terms
# * are also available at https://curl.haxx.se/docs/copyright.html.
# *
# * You may opt to use, copy, modify, merge, publish, distribute and/or sell
# * copies of the Software, and permit persons to whom the Software is
# * furnished to do so, under the terms of the COPYING file.
# *
# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# * KIND, either express or implied.
# *
# ***************************************************************************
#
# This Bourne shell script file is used by test case 1221 to do
# unit testing of curl_10char_object_name() shell function which
# is defined in file objnames.inc and sourced by this file and
# any other shell script that may use it.
#
#
# argument validation
#
if test $# -eq 1; then
:
else
echo "Usage: ${0} srcdir"
exit 1
fi
if test -f "${1}/runtests.pl"; then
:
else
echo "${0}: Wrong srcdir"
exit 1
fi
srcdir=${1}
if test -f "$srcdir/objnames.inc"; then
:
else
echo "$0: Missing objnames.inc"
exit 1
fi
#
# Some variables
#
logdir=log
tstnum=1221
list_c=$logdir/${tstnum}_list_c
list_obj=$logdir/${tstnum}_list_obj
list_obj_c=$logdir/${tstnum}_list_obj_c
list_obj_uniq=$logdir/${tstnum}_list_obj_uniq
#
# Source curl_10char_object_name() function definition
#
. $srcdir/objnames.inc
#
# Some curl_10char_object_name() unit tests
#
echo 'Testing curl_10char_object_name...'
echo ""
argstr=123__678__ABC__FGH__KLM__PQRSTUV
expect=16AFKPQRST
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123__678__ABC__FGH__KLM__PQ.S.UV
expect=16AFKPQ
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123__678__ABC..FGH..KLM..PQRSTUV
expect=16ABC
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123__678_.ABC._FGH__KLM__PQRSTUV
expect=16
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123.567.90ABCDEFGHIJKLMNOPQRSTUV
expect=123
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=1234567.90A.CDEFGHIJKLMNOPQRSTUV
expect=1234567
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=1234567890.BCD.FGHIJKLMNOPQRSTUV
expect=1234567890
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=12=45-78+0AB.DE.GHIJKLMNOPQRSTUV
expect=1470AB
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=1234567890ABCDEFGHIJKLMNOPQRSTUV
expect=1234567890
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123_567_90A_CDE_GHIJKLMNOPQRSTUV
expect=159CGHIJKL
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123_567_90A_CDEFGHIJKLMNOPQRSTUV
expect=159CDEFGHI
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123_567_90ABCDEFGHIJKLMNOPQRSTUV
expect=1590ABCDEF
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=123_567890ABCDEFGHIJKLMNOPQRSTUV
expect=1567890ABC
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
argstr=1234567890ABCDEFGHIJKLMNOPQRSTUV
expect=1234567890
outstr=`curl_10char_object_name $argstr`
echo "result: $outstr expected: $expect input: $argstr"
#
# Verify that generated object name is distinct for
# all *.c source files in lib and src subdirectories.
#
ls $srcdir/../lib/*.c > $list_c
ls $srcdir/../src/*.c >> $list_c
rm -f $list_obj
for c_fname in `cat $list_c`; do
obj_name=`curl_10char_object_name $c_fname`
echo "$obj_name" >> $list_obj
done
sort -u $list_obj > $list_obj_uniq
cnt_c=`cat $list_c | wc -l`
cnt_u=`cat $list_obj_uniq | wc -l`
echo ""
echo ""
echo ""
if test $cnt_c -eq $cnt_u; then
echo "10-characters-or-less generated object names are unique."
obj_name_clash="no"
else
echo "10-characters-or-less generated object names are clashing..."
obj_name_clash="yes"
fi
if test $obj_name_clash = "yes"; then
#
# Show clashing object names and respective source file names
#
echo ""
paste $list_obj $list_c | sort > $list_obj_c
prev_match="no"
prev_line="unknown"
prev_obj_name="unknown"
while read this_line; do
obj_name=`echo "$this_line" | cut -f1`
if test "x$obj_name" = "x$prev_obj_name"; then
if test "x$prev_match" != "xyes"; then
echo "$prev_line"
echo "$this_line"
prev_match="yes"
else
echo "$this_line"
fi
else
prev_match="no"
fi
prev_line=$this_line
prev_obj_name=$obj_name
done < $list_obj_c
fi
rm -f $list_c
rm -f $list_obj
rm -f $list_obj_c
rm -f $list_obj_uniq
# end of objnames-test10.sh

View File

@ -1,107 +0,0 @@
# ***************************************************************************
# * _ _ ____ _
# * Project ___| | | | _ \| |
# * / __| | | | |_) | |
# * | (__| |_| | _ <| |___
# * \___|\___/|_| \_\_____|
# *
# * Copyright (C) 2012 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
# *
# * This software is licensed as described in the file COPYING, which
# * you should have received as part of this distribution. The terms
# * are also available at https://curl.haxx.se/docs/copyright.html.
# *
# * You may opt to use, copy, modify, merge, publish, distribute and/or sell
# * copies of the Software, and permit persons to whom the Software is
# * furnished to do so, under the terms of the COPYING file.
# *
# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# * KIND, either express or implied.
# *
# ***************************************************************************
#
# This file is sourced from curl/packages/OS400/initscript.sh and
# other Bourne shell scripts. Keep it as portable as possible.
#
#
# curl_10char_object_name
#
# This shell function accepts a single string argument with unspecified
# length representing a (*.c) source file name and returns a string which
# is a transformation of given argument.
#
# 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.
#
# This function might not be universally useful, nor we care about it.
#
# It is intended to be used with libcurl's (*.c) source file names, so
# dependency on libcurl's source file naming scheme is acceptable and
# good enough for its intended use. Specifically it makes use of the fact
# that libcurl's (*.c) source file names which may be longer than 10 chars
# are conformed with underscore '_' separated substrings, or separated by
# other character which does not belong to the [0-9], [a-z] or [A-Z] sets.
#
# This allows repeatable and automatic short object name generation with
# no need for a hardcoded mapping table.
#
# Transformation is done in the following way:
#
# 1) Leading directory components are removed.
# 2) Leftmost dot character and any other char following it are removed.
# 3) Lowercase characters are transliterated to uppercase.
# 4) Characters not in [A-Z] or [0-9] are transliterated to underscore '_'.
# 5) Every sequence of one or more underscores is replaced with a single one.
# 6) Five leftmost substrings which end in an underscore character are
# replaced by the first character of each substring, while retaining
# the rest of the string.
# 7) Finally the result is truncated to 10 characters.
#
# Resulting object name may be shorter than 10 characters.
#
# 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.
#
curl_10char_object_name() {
echo "${1}" | \
sed -e 's:.*/::' \
-e 's:[.].*::' \
-e 'y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:' \
-e 's:[^ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_]:_:g' \
-e 's:__*:_:g' \
-e 's:\([^_]\)[^_]*_\(.*\):\1\2:' \
-e 's:\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3:' \
-e 's:\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3\4:' \
-e 's:\([^_]\)\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3\4\5:' \
-e 's:\([^_]\)\([^_]\)\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3\4\5\6:' \
-e 's:^\(..........\).*:\1:'
}
#
# curl_8char_object_name
#
# Same as curl_10char_object_name() description and details above, except
# that object name is limited to 8 characters maximum.
#
curl_8char_object_name() {
echo "${1}" | \
sed -e 's:.*/::' \
-e 's:[.].*::' \
-e 'y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:' \
-e 's:[^ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_]:_:g' \
-e 's:__*:_:g' \
-e 's:\([^_]\)[^_]*_\(.*\):\1\2:' \
-e 's:\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3:' \
-e 's:\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3\4:' \
-e 's:\([^_]\)\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3\4\5:' \
-e 's:\([^_]\)\([^_]\)\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\):\1\2\3\4\5\6:' \
-e 's:^\(........\).*:\1:'
}
# end of objectname.inc