Skip to content

Commit

Permalink
Merge pull request #600 from mkoura/grep_errors
Browse files Browse the repository at this point in the history
Produce log file with all errors as testing artifact
  • Loading branch information
mkoura authored Jul 6, 2021
2 parents 1dcccf6 + 28b5b2c commit 6590f0e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .buildkite/grep_errors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

ARTIFACTS_DIR="${ARTIFACTS_DIR:-".artifacts"}"
LOGFILE="$PWD/errors_all.log"

# there should be only one dir matching "pytest-*" in the artifacts dir
pushd "$ARTIFACTS_DIR/pytest-*" || { echo "Cannot switch to $ARTIFACTS_DIR/pytest-*"; ls -1a "$ARTIFACTS_DIR"; exit 1; } > "$LOGFILE"
grep -r --include "*.stdout" --include "*.stderr" -Ei ":error:|failed|failure" . > "$LOGFILE"
popd || exit 1
10 changes: 8 additions & 2 deletions .buildkite/nightly.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p niv nix gnumake gnutar coreutils adoptopenjdk-jre-bin curl git
#! nix-shell -i bash -p niv nix gnugrep gnumake gnutar coreutils adoptopenjdk-jre-bin curl git
#! nix-shell -I nixpkgs=./nix
# shellcheck shell=bash

set -xeuo pipefail

REPODIR="$PWD"
export ARTIFACTS_DIR="${ARTIFACTS_DIR:-".artifacts"}"

WORKDIR="/scratch/workdir"
rm -rf "$WORKDIR"
Expand All @@ -24,14 +25,19 @@ pushd "$WORKDIR"
pushd "$REPODIR"

# run tests and generate report
rm -rf "${ARTIFACTS_DIR:?}"/*
set +e
# shellcheck disable=SC2016
nix-shell --run \
'SCHEDULING_LOG=scheduling.log CARDANO_NODE_SOCKET_PATH="$CARDANO_NODE_SOCKET_PATH_CI" CI_ARGS="--html=testrun-report.html --self-contained-html" make tests; retval="$?"; ./.buildkite/report.sh .; exit "$retval"'
retval="$?"

# grep testing artifacts for errors
# shellcheck disable=SC1090,SC1091
. "$REPODIR/.buildkite/grep_errors.sh"

echo
echo "Dir content:"
ls -1
ls -1a

exit "$retval"
10 changes: 8 additions & 2 deletions .buildkite/nightly_dbsync.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p niv nix gnumake gnutar coreutils adoptopenjdk-jre-bin curl git
#! nix-shell -i bash -p niv nix gnugrep gnumake gnutar coreutils adoptopenjdk-jre-bin curl git
#! nix-shell -I nixpkgs=./nix
# shellcheck shell=bash

set -xeuo pipefail

REPODIR="$PWD"
export ARTIFACTS_DIR="${ARTIFACTS_DIR:-".artifacts"}"

WORKDIR="/scratch/workdir"
rm -rf "$WORKDIR"
Expand Down Expand Up @@ -47,14 +48,19 @@ export PGPORT=5432
./scripts/postgres-start.sh "$WORKDIR/postgres" -k

# run tests and generate report
rm -rf "${ARTIFACTS_DIR:?}"/*
set +e
# shellcheck disable=SC2016
nix-shell --run \
'SCHEDULING_LOG=scheduling.log CARDANO_NODE_SOCKET_PATH="$CARDANO_NODE_SOCKET_PATH_CI" CLUSTERS_COUNT=5 CI_ARGS="-m dbsync --html=testrun-report.html --self-contained-html" make tests; retval="$?"; ./.buildkite/report.sh .; exit "$retval"'
retval="$?"

# grep testing artifacts for errors
# shellcheck disable=SC1090,SC1091
. "$REPODIR/.buildkite/grep_errors.sh"

echo
echo "Dir content:"
ls -1
ls -1a

exit "$retval"

0 comments on commit 6590f0e

Please sign in to comment.