| 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 |
| 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 |