unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob f8ab676a82b356abe7fc393431bdea1afe962545 2786 bytes (raw)
name: test/notmuch-test 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
 
#!/usr/bin/env bash

# Run tests
#
# Copyright (c) 2005 Junio C Hamano
# Copyright (c) 2010 Notmuch Developers
#
# Adapted from a Makefile to a shell script by Carl Worth (2010)

if [ ${BASH_VERSINFO[0]} -lt 4 ]; then
    echo "Error: The notmuch test suite requires a bash version >= 4.0"
    echo "due to use of associative arrays within the test suite."
    echo "Please try again with a newer bash (or help us fix the"
    echo "test suite to be more portable). Thanks."
    exit 1
fi

# Ensure NOTMUCH_SRCDIR and NOTMUCH_BUILDDIR are set.
. $(dirname "$0")/export-dirs.sh || exit 1

set -eu

TESTS=
for test in ${NOTMUCH_TESTS-}; do
    TESTS="$TESTS $NOTMUCH_SRCDIR/test/$test"
done

if [ -z "$TESTS" ]; then
    TESTS="$NOTMUCH_SRCDIR/test/T[0-9][0-9][0-9]-*.sh"
fi

# Clean up any results from a previous run
rm -rf $NOTMUCH_BUILDDIR/test/test-results

# Test for timeout utility
if command -v timeout >/dev/null; then
    TEST_TIMEOUT=${NOTMUCH_TEST_TIMEOUT:-2m}
    if [ "$TEST_TIMEOUT" = 0 ]; then
        TEST_TIMEOUT_CMD=""
        echo "INFO: timeout disabled"
    else
        TEST_TIMEOUT_CMD="timeout $TEST_TIMEOUT"
        echo "INFO: using $TEST_TIMEOUT timeout for tests"
    fi
else
    TEST_TIMEOUT_CMD=""
fi

# if NOTMUCH_TEST_PARALLEL is unset, set it to the number of cores
# if NOTMUCH_TEST_PARALLEL is set but empty, don't run tests in parallel
# user can set NOTMUCH_TEST_PARALLEL to a numeric value...
: ${NOTMUCH_TEST_PARALLEL=`exec nproc`} || : # nproc may not be available in all systems...

META_FAILURE=
RES=0
# Run the tests
if test "$NOTMUCH_TEST_PARALLEL"; then
    test -t 1 && export COLORS_WITHOUT_TTY=t
    echo "INFO: running tests parallel, $NOTMUCH_TEST_PARALLEL tests..."
    make -k -f $NOTMUCH_SRCDIR/test/parallel.mk -j $NOTMUCH_TEST_PARALLEL \
            TIMEOUT_CMD="$TEST_TIMEOUT_CMD" $TESTS || {
        RES=$?
        META_FAILURE="parallel test suite returned error code $RES"
    }
else
    trap 'e=$?; trap - 0; kill ${!-}; exit $e' 0 HUP INT TERM
    for test in $TESTS; do
        $TEST_TIMEOUT_CMD $test "$@" &
        wait $! && ev=0 || ev=$?
        test $ev = 0 || RES=$ev
    done
    trap - 0 HUP INT TERM
    if [ $RES != 0 ]; then
        META_FAILURE="some tests failed; first failed returned error code $RES"
    fi
fi

# Report results
RESULT_FILES=
for file in $TESTS
do
    file=${file##*/} # drop leading path components
    file=${file%.sh} # drop trailing '.sh'
    RESULT_FILES="$RESULT_FILES $NOTMUCH_BUILDDIR/test/test-results/$file"
done

echo
$NOTMUCH_SRCDIR/test/aggregate-results.sh $RESULT_FILES && ev=0 || ev=$?

if [ -n "$META_FAILURE" ]; then
    printf 'ERROR: %s\n' "$META_FAILURE"
    if [ $ev = 0 ]; then
        ev=$RES
    fi
fi

# Clean up
rm -rf $NOTMUCH_BUILDDIR/test/test-results

exit $ev

debug log:

solving f8ab676a ...
found f8ab676a in https://yhetil.org/notmuch/20210817091216.26044-1-tomi.ollila@iki.fi/
found 14747bdb in https://yhetil.org/notmuch.git/
preparing index
index prepared:
100755 14747bdbfc44d040cc0118d3d84328a7c69e6e06	test/notmuch-test

applying [1/1] https://yhetil.org/notmuch/20210817091216.26044-1-tomi.ollila@iki.fi/
diff --git a/test/notmuch-test b/test/notmuch-test
index 14747bdb..f8ab676a 100755

Checking patch test/notmuch-test...
Applied patch test/notmuch-test cleanly.

index at:
100755 f8ab676a82b356abe7fc393431bdea1afe962545	test/notmuch-test

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).