Commit d089353f authored by Rob Latham's avatar Rob Latham Committed by Pavan Balaji
Browse files

testcase for status object manipulations



MPI_Count in a status object breaks ABI, so we have a scheme to use lo
and hi parts of adjacent struct members.  but it's not foolproof.  Test
case to demonstrate bugs and hopefully catch future regressions.
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@mcs.anl.gov>
parent a5aa7920
......@@ -48,5 +48,6 @@ noinst_PROGRAMS = \
waittestnull \
sendall \
large_message \
mprobe
mprobe \
big_count_status
#include <mpi.h>
#include <assert.h>
#include <stdio.h>
int test_count(MPI_Count count)
{
MPI_Status stat;
int cancelled, cancelled2;
MPI_Count bcount, bcount2;
int nerrs = 0;
bcount = count;
cancelled = 0;
MPI_Status_set_cancelled(&stat, cancelled);
MPI_Status_set_elements_x(&stat, MPI_BYTE, bcount);
MPI_Get_elements_x(&stat, MPI_BYTE, &bcount2);
MPI_Test_cancelled(&stat, &cancelled2);
if (bcount != bcount2) {
fprintf(stderr, "Count Error: expected %lx, got %lx\n", bcount, bcount2);
nerrs++;
}
if (cancelled != cancelled2) {
fprintf(stderr, "Cancelled Error: expected %d, got %d\n", cancelled, cancelled2);
nerrs++;
}
return nerrs;
}
int main(int argc, char **argv)
{
int nerrors = 0;
MPI_Init(&argc, &argv);
/* baseline: this tiny value should pose no problems */
nerrors += test_count(60);
/* one with no next-to-high-bits set */
nerrors += test_count(0x3654321f71234567);
/* masking after shift can help the count_high, but count_low is still
* wrong */
nerrors += test_count(0x7654321f71234567);
/* original problematic count reported by Artem Yalozo */
nerrors += test_count(0x7654321ff1234567);
if (nerrors != 0) {
fprintf(stderr, "found %d errors\n", nerrors);
}
else {
printf(" No Errors\n");
}
MPI_Finalize();
}
......@@ -37,3 +37,4 @@ waitany-null 1
# perhaps disable in the release tarball
large_message 3
mprobe 2 mpiversion=3.0
big_count_status 1 mpiversion=3.0
Markdown is supported
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