Home | History | Annotate | Download | only in util
      1 #!/bin/sh
      2 # Copyright (c) 2016, Google Inc.
      3 #
      4 # Permission to use, copy, modify, and/or distribute this software for any
      5 # purpose with or without fee is hereby granted, provided that the above
      6 # copyright notice and this permission notice appear in all copies.
      7 #
      8 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
      9 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     10 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
     11 # SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     12 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
     13 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
     14 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     15 
     16 set -xe
     17 
     18 SRC=$PWD
     19 
     20 BUILD=$(mktemp -d '/tmp/boringssl.XXXXXX')
     21 BUILD_SRC=$(mktemp -d '/tmp/boringssl-src.XXXXXX')
     22 LCOV=$(mktemp -d '/tmp/boringssl-lcov.XXXXXX')
     23 
     24 if [ -n "$1" ]; then
     25   LCOV=$(readlink -f "$1")
     26   mkdir -p "$LCOV"
     27 fi
     28 
     29 cd "$BUILD"
     30 cmake "$SRC" -GNinja -DGCOV=1
     31 ninja
     32 
     33 cp -r "$SRC/crypto" "$SRC/decrepit" "$SRC/include" "$SRC/ssl" "$SRC/tool" \
     34   "$BUILD_SRC"
     35 cp -r "$BUILD"/* "$BUILD_SRC"
     36 mkdir "$BUILD/callgrind/"
     37 
     38 cd "$SRC"
     39 go run "$SRC/util/all_tests.go" -build-dir "$BUILD" -callgrind -num-workers 16
     40 util/generate-asm-lcov.py "$BUILD/callgrind" "$BUILD" > "$BUILD/asm.info"
     41 
     42 go run "util/all_tests.go" -build-dir "$BUILD"
     43 
     44 cd "$SRC/ssl/test/runner"
     45 go test -shim-path "$BUILD/ssl/test/bssl_shim" -num-workers 1
     46 
     47 cd "$LCOV"
     48 lcov -c -d "$BUILD" -b "$BUILD" -o "$BUILD/lcov.info"
     49 lcov -r "$BUILD/lcov.info" -o "$BUILD/filtered.info" "*_test.c" "*_test.cc" "*/third_party/googletest/*"
     50 cat "$BUILD/filtered.info" "$BUILD/asm.info" > "$BUILD/final.info"
     51 sed -i "s;$BUILD;$BUILD_SRC;g" "$BUILD/final.info"
     52 sed -i "s;$SRC;$BUILD_SRC;g" "$BUILD/final.info"
     53 genhtml -p "$BUILD_SRC" "$BUILD/final.info"
     54 
     55 rm -rf "$BUILD"
     56 rm -rf "$BUILD_SRC"
     57 
     58 xdg-open index.html
     59