1#!/bin/sh 2# Copyright 2016 The BoringSSL Authors 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# https://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16set -xe 17 18SRC=$PWD 19 20BUILD=$(mktemp -d '/tmp/boringssl.XXXXXX') 21BUILD_SRC=$(mktemp -d '/tmp/boringssl-src.XXXXXX') 22LCOV=$(mktemp -d '/tmp/boringssl-lcov.XXXXXX') 23 24if [ -n "$1" ]; then 25 LCOV=$(readlink -f "$1") 26 mkdir -p "$LCOV" 27fi 28 29cd "$BUILD" 30cmake "$SRC" -GNinja -DGCOV=1 31ninja 32 33cp -r "$SRC/crypto" "$SRC/decrepit" "$SRC/include" "$SRC/ssl" "$SRC/tool" \ 34 "$BUILD_SRC" 35cp -r "$BUILD"/* "$BUILD_SRC" 36mkdir "$BUILD/callgrind/" 37 38cd "$SRC" 39go run "$SRC/util/all_tests.go" -build-dir "$BUILD" -callgrind -num-workers 16 40util/generate-asm-lcov.py "$BUILD/callgrind" "$BUILD" > "$BUILD/asm.info" 41 42go run "util/all_tests.go" -build-dir "$BUILD" 43 44cd "$SRC/ssl/test/runner" 45go test -shim-path "$BUILD/ssl/test/bssl_shim" -num-workers 1 46 47cd "$LCOV" 48lcov -c -d "$BUILD" -b "$BUILD" -o "$BUILD/lcov.info" 49lcov -r "$BUILD/lcov.info" -o "$BUILD/filtered.info" "*_test.c" "*_test.cc" "*/third_party/googletest/*" 50cat "$BUILD/filtered.info" "$BUILD/asm.info" > "$BUILD/final.info" 51sed -i "s;$BUILD;$BUILD_SRC;g" "$BUILD/final.info" 52sed -i "s;$SRC;$BUILD_SRC;g" "$BUILD/final.info" 53genhtml -p "$BUILD_SRC" "$BUILD/final.info" 54 55rm -rf "$BUILD" 56rm -rf "$BUILD_SRC" 57 58xdg-open index.html 59