Skip to content

Commit 3a2150c

Browse files
Fix version checking
1 parent df0ecec commit 3a2150c

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# The Schema tests require a JDK because we use the
22
# Java standard libraries builtin schema validation functionality
33
find_package(Java COMPONENTS Development)
4-
if(${Java_FOUND} AND ${Java_VERSION_MAJOR} VERSION_GREATER 8)
4+
find_package(Python3 COMPONENTS Interpreter)
5+
if(${Python3_FOUND} AND ${Python3_VERSION} VERSION_GREATER 3.5
6+
AND ${Java_FOUND} AND ${Java_VERSION_MAJOR} VERSION_GREATER 8)
57
add_test(NAME validate-trace-xml-schema
68
COMMAND python3 check.py $<TARGET_FILE:cbmc>
79
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
@@ -10,4 +12,4 @@ if(${Java_FOUND} AND ${Java_VERSION_MAJOR} VERSION_GREATER 8)
1012
LABELS "CBMC;CORE")
1113
else()
1214
message(WARNING "JDK not found, skipping trace schema tests")
13-
endif()
15+
endif()
Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
1-
if command -v javac && command -v python3
2-
then
3-
python3 check.py ../../src/cbmc/cbmc
4-
else
5-
echo "javac or python3 not found, skipping XSD tests"
1+
if ! command -v python3 > /dev/null; then
2+
echo "python3 not found, skipping XSD tests"
3+
exit
64
fi
5+
6+
python_minor_version=$(python3 --version | cut -d ' ' -f 2 | cut -d '.' -f 2)
7+
8+
if [ $python_minor_version -lt 5 ]; then
9+
echo "python version less than 3.5, skipping XSD tests"
10+
exit
11+
fi
12+
13+
if ! command -v javac > /dev/null; then
14+
echo "javac not found, skipping XSD tests"
15+
exit
16+
fi
17+
18+
# Java versions are complicated
19+
20+
java_version=$(javac -version | cut -d ' ' -f 2)
21+
javac_major_version=$(echo $java_version | cut -d '.' -f 1)
22+
javac_minor_version=$(echo $java_version | cut -d '.' -f 2)
23+
24+
if [ $javac_major_version -eq 1 ] || [ $javac_minor_version -ge 8 ]; then
25+
echo "JDK version less than 8, skipping XSD tests"
26+
exit
27+
fi
28+
29+
python3 check.py ../../src/cbmc/cbmc

0 commit comments

Comments
 (0)