#!/bin/sh testname=${0#$srcdir/} if test -z "$MH_OBJ_DIR"; then srcdir=`dirname "$0"`/../.. MH_OBJ_DIR=`cd "$srcdir" && pwd`; export MH_OBJ_DIR fi . "$MH_OBJ_DIR/test/common.sh" rm -rf "$MH_TEST_DIR/panda" imap_cleanup() { #### Save exit status to use as status for this program. status=$? set +e [ -n "$imapd_pid" ] && kill $imapd_pid # TODO uh oops don't need two profiles for this one for i in 1 2; do set_mh_profile profile$i "$MH_OBJ_DIR/target/debug/mhimap" imap shutdown done if [ -z "$MH_TEST_NOCLEANUP" ]; then rm -rf "$MH_TEST_DIR/panda" for i in 1 2; do rm -rf "$MH_TEST_DIR/profile$i" done fi # TODO have cleanup allow additional cleanup registration? # Or just allow it to accept status as argument. (exit $status) cleanup } covdir="$MH_OBJ_DIR/covdata/${MH_COVERAGE_PROFILE:-default}/$testname" install -d "$covdir" mkdir "$MH_TEST_DIR/panda" mkdir "$MH_TEST_DIR/panda/test" expected="$MH_TEST_DIR/$$.expected" actual="$MH_TEST_DIR/$$.actual" uidvalidity=1503585238 cat > $MH_TEST_DIR/panda/test/fold < "$actual" 2>&1 || status=$? } # setup profile 2 and 1, leaving 1 as active profile for i in 2 1; do setup_test_without_data profile$i trap imap_cleanup 0 cat >> "$MH" <> "$MH" echo "imap-log-$MH_TEST_IMAP_LOG_LEVEL-to: $MH_TEST_DIR/$profile/imap.d/log.$MH_TEST_IMAP_LOG_LEVEL" >> "$MH" fi start done ################################################################################ start_test '1. inc from profile1' echo 'Incorporating new mail into imap/fold...' > "$expected.inc" echo >> "$expected.inc" printf ' 1 10/24 me <>\n' >> "$expected.inc" inc +imap -form scan.unseen -width 80 > "$actual" check "$actual" "$expected.inc" ################################################################################ # 2. rebuild mailbox uidvalidity=1603585238 cat > $MH_TEST_DIR/panda/test/fold <&2 fail "'UIDVALIDITY changed' not in $MH_TEST_DIR/profile$i/imap.d/stderr" fi finish_test exit ${failed:-0}