Skip to content

Commit 1f849fe

Browse files
committed
testing regexes
1 parent 2b0f1f4 commit 1f849fe

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/test_certs_r4_with_oqs.sh

+10-5
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,25 @@ printf "Build time: %s\n\n" "$(date)" > $logfile
1313

1414
alreadyTestedOIDs=";"
1515

16+
_FILENAME_REGEX = re.compile(r'^(?P<friendlyName>.*)-(?P<oid>[^\.0-9]+)_ta.der$', re.IGNORECASE)
17+
1618
# Requires an input: the TA file to test
1719
test_ta () {
1820
tafile=$1
1921
resultsfile=$2
2022

2123
tafileBasename=$(basename $tafile)
2224

25+
# strip off the friendly name
26+
tafileBasename=$(echo $tafileBasename | egrep -o '[^-]+_ta.der$')
27+
28+
2329
# strip off the file suffix to get the OID name
24-
if [[ $(expr match "$tafileBasename" ".*_ta\.pem$") != 0 ]]; then
25-
oid=${tafileBasename%_ta.pem}
26-
elif [[ $(expr match "$tafileBasename" ".*_ta\.der$") != 0 ]]; then
30+
if [[ $(expr match "$tafileBasename" ".*_ta\.der$") != 0 ]]; then
2731
oid=${tafileBasename%_ta.der}
28-
elif [[ $(expr match "$tafileBasename" ".*_ta\.der\.pem$") != 0 ]]; then
29-
oid=${tafileBasename%_ta.der.pem}
32+
33+
printf "DEBUG: filename: $tafileBasename, OID: $oid\n"
34+
3035
else # It's some other filename
3136
printf "ERROR: file name is not in the expected format: %s\n" $tafileBasename
3237
printf "ERROR: file name is not in the expected format: %s\n" $tafileBasename >> $logfile

0 commit comments

Comments
 (0)