qualify-clang.sh: exclude z3 tests when support is not available, not based on libz3-dev installation but on the error returned by clang invocation

This commit is contained in:
Gianfranco Costamagna 2020-10-01 15:11:40 +02:00
parent 3041189ac0
commit d34f8688a3

View File

@ -385,9 +385,16 @@ void testBitwiseRules(unsigned int a, int b) {
clang_analyzer_eval((b | -2) >= 0); // expected-warning{{FALSE}}
}
' > foo.c
if dpkg -l|grep -q libz3-dev; then
# Should work
clang-$VERSION -cc1 -analyze -analyzer-constraints=range -analyzer-checker=core,debug.ExprInspection -analyzer-constraints=z3 foo.c &> foo.log
if ! grep -q "fatal error: error in backend: LLVM was not compiled with Z3 support, rebuild with -DLLVM_ENABLE_Z3_SOLVER=ON" foo.log; then
# Should work
clang-$VERSION -cc1 -analyze -analyzer-constraints=range -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false -analyzer-constraints=z3 foo.c
clang-$VERSION -cc1 -analyze -analyzer-constraints=range -analyzer-checker=core,debug.ExprInspection -analyzer-constraints=z3 foo.c &> foo.log
if ! grep -q "2 warnings generated." foo.log; then
echo "Should find 2 warnings"
exit 1
fi
else
echo "z3 support not available"
fi
@ -399,16 +406,6 @@ if grep -q "File a.c Line 7: UNKNOWN" foo.log; then
exit 1
fi
if dpkg -l|grep -q libz3-dev; then
clang-$VERSION -cc1 -analyze -analyzer-constraints=range -analyzer-checker=core,debug.ExprInspection -analyzer-constraints=z3 foo.c &> foo.log
if ! grep -q "2 warnings generated." foo.log; then
echo "Should find 2 warnings"
exit 1
fi
else
echo "z3 support not available"
fi
clang-$VERSION -cc1 -analyze -analyzer-constraints=range -analyzer-checker=core,debug.ExprInspection foo.c &> foo.log
if ! grep -q "warnings generated." foo.log; then
echo "Should find at least 2 warnings"