<commit_before>#!/bin/bash

set -e -x

cd `git rev-parse --show-toplevel`
godep go test -v -race ./... | go-junit-report -dir $CIRCLE_TEST_REPORTS/go

# Run test coverage on each subdirectories and merge the coverage profile.
echo "mode: set" > profile.cov
repo_pref="github.com/${CIRCLE_PROJECT_USERNAME-"$(basename `pwd`)"}/${CIRCLE_PROJECT_REPONAME-"$(basename `pwd`)"}/"
# Standard go tooling behavior is to ignore dirs with leading underscores
set -x
for dir in $(go list ./... | grep -v generator)
do
  pth="${dir//*$repo_pref}"
  godep go test -covermode=set -coverprofile=${pth}/profile.tmp $dir
  if [ -f $pth/profile.tmp ]
  then
      cat $pth/profile.tmp | tail -n +2 >> profile.cov
      rm $pth/profile.tmp
  fi
done

set +x
godep go tool cover -func profile.cov
gocov convert profile.cov | gocov report
gocov convert profile.cov | gocov-html > $CIRCLE_ARTIFACTS/coverage-$CIRCLE_BUILD_NUM.html<commit_msg>don't use git root dir in test script<commit_after>#!/bin/bash

set -e -x

cd $GOPATH/src/github.com/go-swagger/go-swagger
godep go test -v -race ./... | go-junit-report -dir $CIRCLE_TEST_REPORTS/go

# Run test coverage on each subdirectories and merge the coverage profile.
echo "mode: set" > profile.cov
repo_pref="github.com/${CIRCLE_PROJECT_USERNAME-"$(basename `pwd`)"}/${CIRCLE_PROJECT_REPONAME-"$(basename `pwd`)"}/"
# Standard go tooling behavior is to ignore dirs with leading underscores
set -x
for dir in $(go list ./... | grep -v generator)
do
  pth="${dir//*$repo_pref}"
  godep go test -covermode=set -coverprofile=${pth}/profile.tmp $dir
  if [ -f $pth/profile.tmp ]
  then
      cat $pth/profile.tmp | tail -n +2 >> profile.cov
      rm $pth/profile.tmp
  fi
done

set +x
godep go tool cover -func profile.cov
gocov convert profile.cov | gocov report
gocov convert profile.cov | gocov-html > $CIRCLE_ARTIFACTS/coverage-$CIRCLE_BUILD_NUM.html
{'fraction_non_alphanumeric': 0.13798614810868406, 'fraction_numerical': 0.0010655301012253596, 'mean_word_length': 3.8030690537084397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1313903', 'n_tokens_mistral': 712, 'n_tokens_neox': 688, 'n_words': 194}