-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathcodeprofile.sh
executable file
·48 lines (37 loc) · 989 Bytes
/
codeprofile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -ex
# Save off the current folder as the build root.
export BUILD_ROOT=$PWD
SCRIPTDIR=${BUILD_ROOT}/scripts
CURLDIR=/tmp/curlprof
OPENSSLDIR=/tmp/openssl
NGHTTPDIR=/tmp/nghttp2
INSTALLDIR=/tmp/curlprof_install
# Parse the options.
OPTIND=1
while getopts "c:n:o:" opt
do
case "$opt" in
c) CURLDIR=$OPTARG
;;
n) NGHTTPDIR=$OPTARG
;;
o) OPENSSLDIR=$OPTARG
;;
esac
done
shift $((OPTIND-1))
# Use clang to test the code as it allows use of libsanitizer.
export CC=gcc
export CXX=g++
export CFLAGS="-pg"
export CXXFLAGS="-pg"
# Install openssl
${SCRIPTDIR}/handle_x.sh openssl ${OPENSSLDIR} ${INSTALLDIR} || exit 1
# Install nghttp2
${SCRIPTDIR}/handle_x.sh nghttp2 ${NGHTTPDIR} ${INSTALLDIR} || exit 1
# Install curl after all other dependencies
${SCRIPTDIR}/handle_x.sh curl ${CURLDIR} ${INSTALLDIR} || exit 1
# Compile and test the fuzzers.
${SCRIPTDIR}/compile_fuzzer.sh ${INSTALLDIR} || exit 1
gprof ${BUILD_ROOT}/curl_fuzzer