Commit 10768ad9 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Improve check that the expected failure was observed.

parent 3257a070
......@@ -293,9 +293,7 @@ TESTS = \
test_perf_stripes_run \
test_sort_run \
test_uid_run \
test_yaxt_run
XFAIL_TESTS = \
test_yaxt_run \
test_xmap_all2all_fail_run
AUTOMAKE_OPTIONS = color-tests
......
......@@ -57,6 +57,11 @@
#define VERBOSE
#include "tests.h"
/* If we're not using GNU C, elide __attribute__ */
#ifndef __GNUC__
# define __attribute__(x) /*NOTHING*/
#endif
static enum {
SMALL,
BIG,
......@@ -64,6 +69,15 @@ static enum {
static void
parse_options(int *argc, char ***argv);
static void
xfail_abort(MPI_Comm comm, const char *msg, const char *source, int line)
__attribute__((noreturn));
typedef void (*Xt_abort_func)(MPI_Comm comm, const char *msg,
const char *source, int line)
__attribute__((noreturn));
extern Xt_abort_func Xt_abort;
int main(int argc, char **argv) {
......@@ -94,26 +108,12 @@ int main(int argc, char **argv) {
// test of exchange map
// NOTE: this should fail
Xt_abort = xfail_abort;
Xt_xmap xmap
= xt_xmap_all2all_new(src_idxlist, dst_idxlist, MPI_COMM_WORLD);
// test results
if (xt_xmap_get_num_destinations(xmap) != 1)
PUT_ERR("error in xt_xmap_get_num_destinations\n");
if (xt_xmap_get_num_sources(xmap) != 1)
PUT_ERR("error in xt_xmap_get_num_destinations\n");
int rank;
xt_xmap_get_destination_ranks(xmap, &rank);
if (rank != my_rank)
PUT_ERR("error in xt_xmap_get_destination_ranks\n");
xt_xmap_get_source_ranks(xmap, &rank);
if (rank != my_rank)
PUT_ERR("error in xt_xmap_get_source_ranks\n");
/* this position should not be reached */
MPI_Abort(MPI_COMM_WORLD, 1);
// clean up
xt_xmap_delete(xmap);
......@@ -147,6 +147,14 @@ parse_options(int *argc, char ***argv)
}
}
static void
xfail_abort(MPI_Comm comm, const char *msg, const char *source, int line)
{
fprintf(stderr, "Fatal error in %s, line %d: %s\n", source, line, msg);
MPI_Abort(comm, 3);
abort();
}
/*
* Local Variables:
* c-basic-offset: 2
......
......@@ -51,8 +51,15 @@ PROGRAM test_xmap_all2all_fail
xt_idxlist, xt_idxlist_delete, xt_idxvec_new, &
xt_xmap, xt_xmap_delete, xt_xmap_all2all_new, &
xt_xmap_get_num_destinations, xt_xmap_get_num_sources, &
xt_xmap_get_destination_ranks, xt_xmap_get_source_ranks
xt_xmap_get_destination_ranks, xt_xmap_get_source_ranks, &
xt_set_abort_handler, xt_restore_default_abort_hndl
IMPLICIT NONE
INTERFACE
SUBROUTINE xfail_abort(comm, msg, source, line)
INTEGER, INTENT(in) :: comm, line
CHARACTER(len=*), INTENT(in) :: msg, source
END SUBROUTINE xfail_abort
END INTERFACE
INTEGER, PARAMETER :: xi = xt_int_kind
CHARACTER(len=*), PARAMETER :: filename = 'test_xmap_all2all_fail_f.f90'
INTEGER :: my_rank, ierror, list_size
......@@ -84,7 +91,9 @@ CONTAINS
src_idxlist = xt_idxvec_new(src_index_list)
dst_idxlist = xt_idxvec_new(dst_index_list)
CALL xt_set_abort_handler(xfail_abort)
xmap = xt_xmap_all2all_new(src_idxlist, dst_idxlist, mpi_comm_world)
CALL xt_restore_default_abort_hndl
CALL xt_idxlist_delete(src_idxlist)
CALL xt_idxlist_delete(dst_idxlist)
......@@ -156,6 +165,21 @@ CONTAINS
END SUBROUTINE parse_options
END PROGRAM test_xmap_all2all_fail
SUBROUTINE xfail_abort(comm, msg, source, line)
USE iso_c_binding, ONLY: c_int
USE mpi
USE ftest_common, ONLY: posix_exit
INTEGER, INTENT(in) :: comm, line
CHARACTER(len=*), INTENT(in) :: msg, source
INTEGER :: ierror
WRITE (0, '(4a,i0)') msg, ' at ', source, ', line ', line
FLUSH(0)
CALL mpi_abort(comm, 3, ierror)
CALL posix_exit(3_c_int)
END SUBROUTINE xfail_abort
!
! Local Variables:
! f90-continuation-indent: 5
......
......@@ -4,18 +4,21 @@ LIBC_FATAL_STDERR_=1
export LIBC_FATAL_STDERR_
[ x"@MPI_LAUNCH@" != xtrue ] || exit 77
ulimit -c 0
@abs_top_builddir@/libtool --mode=execute \
@MPI_LAUNCH@ -n 1 @abs_builddir@/test_xmap_all2all_fail -s small \
>/dev/null 2>&1 \
|| @abs_top_builddir@/libtool --mode=execute \
@MPI_LAUNCH@ -n 1 @abs_builddir@/test_xmap_all2all_fail -s big \
>/dev/null 2>&1 \
|| @abs_top_builddir@/libtool --mode=execute \
@MPI_LAUNCH@ -n 1 @abs_builddir@/test_xmap_all2all_fail_f -s small \
>/dev/null 2>&1 \
|| @abs_top_builddir@/libtool --mode=execute \
@MPI_LAUNCH@ -n 1 @abs_builddir@/test_xmap_all2all_fail_f -s big \
>/dev/null 2>&1
for setup_size in small big; do
for suffix in '' '_f'; do
if @abs_top_builddir@/libtool --mode=execute \
@MPI_LAUNCH@ -n 1 \
@abs_builddir@/test_xmap_all2all_fail$suffix -s $setup_size \
>/dev/null 2>&1; then
exit 1
else
rc=$?
if [ $rc -ne 3 ]; then
exit 1
fi
fi
done
done
#
# Local Variables:
# mode: sh
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment