blob: 7acf005bf462a303f675e69cf7248ab67e4dc35b [file] [log] [blame]
Alexey Samsonov98aa08c2014-02-25 12:09:25 +00001#!/usr/bin/env bash
Lorenzo Martignoni085bf662013-11-27 11:50:44 +00002
3DFSAN_DIR=$(dirname "$0")/../
Lorenzo Martignoni60ebffc2014-10-08 10:01:42 +00004DFSAN_CUSTOM_TESTS=${DFSAN_DIR}/../../test/dfsan/custom.cc
Lorenzo Martignoni085bf662013-11-27 11:50:44 +00005DFSAN_CUSTOM_WRAPPERS=${DFSAN_DIR}/dfsan_custom.cc
6DFSAN_ABI_LIST=${DFSAN_DIR}/done_abilist.txt
7
8DIFFOUT=$(mktemp -q /tmp/tmp.XXXXXXXXXX)
9ERRORLOG=$(mktemp -q /tmp/tmp.XXXXXXXXXX)
10
11on_exit() {
12 rm -f ${DIFFOUT} 2> /dev/null
13 rm -f ${ERRORLOG} 2> /dev/null
14}
15
16trap on_exit EXIT
17
18diff -u \
19 <(grep -E "^fun:.*=custom" ${DFSAN_ABI_LIST} | grep -v "dfsan_get_label" \
20 | sed "s/^fun:\(.*\)=custom.*/\1/" | sort ) \
21 <(grep -E "__dfsw.*\(" ${DFSAN_CUSTOM_WRAPPERS} \
22 | sed "s/.*__dfsw_\(.*\)(.*/\1/" \
23 | sort) > ${DIFFOUT}
24if [ $? -ne 0 ]
25then
26 echo -n "The following differences between the ABI list and ">> ${ERRORLOG}
27 echo "the implemented custom wrappers have been found:" >> ${ERRORLOG}
28 cat ${DIFFOUT} >> ${ERRORLOG}
29fi
30
31diff -u \
32 <(grep -E __dfsw_ ${DFSAN_CUSTOM_WRAPPERS} \
33 | sed "s/.*__dfsw_\([^(]*\).*/\1/" \
34 | sort) \
35 <(grep -E "^\\s*test_.*\(\);" ${DFSAN_CUSTOM_TESTS} \
36 | sed "s/.*test_\(.*\)();/\1/" \
37 | sort) > ${DIFFOUT}
38if [ $? -ne 0 ]
39then
40 echo -n "The following differences between the implemented " >> ${ERRORLOG}
41 echo "custom wrappers and the tests have been found:" >> ${ERRORLOG}
42 cat ${DIFFOUT} >> ${ERRORLOG}
43fi
44
45if [[ -s ${ERRORLOG} ]]
46then
47 cat ${ERRORLOG}
48 exit 1
49fi
50