third_party/rust/regex-0.2.1/ci/run-kcov
author Nick Fitzgerald <fitzgen@gmail.com>
Fri, 01 Sep 2017 16:43:16 -0700
changeset 378421 a8ae266cd61eb004d4f74a989e4d9c6d2ceb5b93
parent 342344 third_party/rust/regex/ci/run-kcov@b92f6949d70442e06c66e2a2d120a81984c8289b
permissions -rwxr-xr-x
Bug 1277338 - Part 13: Update vendored crates for newer `js` crate; r=sfink

#!/bin/bash

set -e

tests=(
  default
  default_bytes
  backtrack
  backtrack_utf8bytes
  backtrack_bytes
  nfa
  nfa_utf8bytes
  nfa_bytes
  regex
)
tmpdir=$(mktemp -d)
with_plugin=
coveralls_id=

while true; do
  case "$1" in
    --with-plugin)
      with_plugin=yes
      shift
      ;;
    --coveralls-id)
      coveralls_id="$2"
      shift 2
      ;;
    *)
      break
      ;;
  esac
done

if [ -n "$with_plugin" ]; then
  cargo test --manifest-path regex_macros/Cargo.toml --no-run --verbose
  kcov \
    --verify \
    --include-pattern '/regex/src/' \
    "$tmpdir/plugin" \
    $(ls -t ./regex_macros/target/debug/plugin-* | head -n1)
fi

cargo test --no-run --verbose --jobs 4
for t in ${tests[@]}; do
  kcov \
    --verify \
    --include-pattern '/regex/src/' \
    "$tmpdir/$t" \
    $(ls -t ./target/debug/"$t"-* | head -n1)
done

if [ -n "$coveralls_id" ]; then
  kcov --verify --coveralls-id=$coveralls_id --merge target/cov "$tmpdir"/*
else
  kcov --verify --merge target/cov "$tmpdir"/*
fi