Commit b26a404f authored by Kenneth Moreland's avatar Kenneth Moreland

ENH: Support correct test reporting when mpirun does not return result.

parent 834762c3
......@@ -97,6 +97,6 @@ int BlankTiles(int argc, char *argv[])
printf("Cleaning up.\n");
finalize_test();
finalize_test(result);
return result;
}
......@@ -104,11 +104,11 @@ int BoundsBehindViewer(int argc, char * argv[])
GLuint *cb = (GLuint *)icetGetColorBuffer();
if (cb[0] != 0xFFFFFFFF) {
printf("First pixel in color buffer wrong: 0x%x\n", cb[0]);
finalize_test();
finalize_test(TEST_FAILED);
return TEST_FAILED;
}
}
finalize_test();
finalize_test(TEST_PASSED);
return TEST_PASSED;
}
......@@ -54,6 +54,15 @@ FOREACH (test ${MyTests})
${PRE_TEST_FLAGS}
${C_TEST_PATH}/icetTests_mpi ${ICET_TEST_FLAGS} ${TName}
${POST_TEST_FLAGS})
IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.1)
SET_TESTS_PROPERTIES(IceT${TName}
PROPERTIES FAIL_REGULAR_EXPRESSION
":ERROR:;TEST NOT RUN;TEST NOT PASSED;TEST FAILED"
)
SET_TESTS_PROPERTIES(IceT${TName}
PROPERTIES PASS_REGULAR_EXPRESSION "Test Passed"
)
ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.1)
ENDFOREACH(test)
IF (WIN32)
......
......@@ -190,6 +190,6 @@ int CompressionSize(int argc, char *argv[])
DoCompressionTest(2);
}
finalize_test();
finalize_test(result);
return result;
}
......@@ -124,6 +124,6 @@ int DisplayNoDraw(int argc, char *argv[])
}
}
finalize_test();
finalize_test(result);
return result;
}
......@@ -223,6 +223,7 @@ static void check_results(int result)
}
if (fail) {
finalize_test(TEST_FAILED);
exit(TEST_FAILED);
}
}
......@@ -523,6 +524,6 @@ int RandomTransform(int argc, char *argv[])
icetInputOutputBuffers(ICET_COLOR_BUFFER_BIT | ICET_DEPTH_BUFFER_BIT,
ICET_COLOR_BUFFER_BIT);
finalize_test();
finalize_test(result);
return result;
}
......@@ -169,6 +169,6 @@ int SimpleExample(int argc, char * argv[])
swap_buffers();
}
finalize_test();
finalize_test(TEST_PASSED);
return TEST_PASSED;
}
......@@ -11,6 +11,7 @@
/* Id */
#include "test-util.h"
#include "test_codes.h"
#include <stdlib.h>
#include <stdio.h>
......@@ -27,8 +28,8 @@
#include <unistd.h>
#else
#include <io.h>
#define dup(fildes) _dup(fildes)
#define dup2(fildes, fildes2) _dup2(fildes, fildes2)
#define dup(fildes) _dup(fildes)
#define dup2(fildes, fildes2) _dup2(fildes, fildes2)
#endif
IceTStrategy strategy_list[5];
......@@ -41,10 +42,10 @@ int SCREEN_HEIGHT;
static void checkOglError(void)
{
GLenum error = glGetError();
#define TRY_ERROR(ename) \
if (error == ename) { \
printf("## Current OpenGL error = " #ename "\n"); \
return; \
#define TRY_ERROR(ename) \
if (error == ename) { \
printf("## Current OpenGL error = " #ename "\n"); \
return; \
}
TRY_ERROR(GL_NO_ERROR);
......@@ -64,10 +65,10 @@ static void checkOglError(void)
static void checkIceTError(void)
{
GLenum error = icetGetError();
#define TRY_ERROR(ename) \
if (error == ename) { \
printf("## Current Ice-T error = " #ename "\n"); \
return; \
#define TRY_ERROR(ename) \
if (error == ename) { \
printf("## Current Ice-T error = " #ename "\n"); \
return; \
}
TRY_ERROR(ICET_NO_ERROR);
TRY_ERROR(ICET_SANITY_CHECK_FAIL);
......@@ -89,10 +90,10 @@ static void realprintf(const char *fmt, ...)
va_list ap;
if (realstdout != NULL) {
va_start(ap, fmt);
vfprintf(realstdout, fmt, ap);
va_end(ap);
fflush(realstdout);
va_start(ap, fmt);
vfprintf(realstdout, fmt, ap);
va_end(ap);
fflush(realstdout);
}
}
#endif
......@@ -133,48 +134,48 @@ void initialize_test(int *argcp, char ***argvp, IceTCommunicator comm)
/* Parse my arguments. */
for (arg = 1; arg < argc; arg++) {
if (strcmp(argv[arg], "-width") == 0) {
width = atoi(argv[++arg]);
} else if (strcmp(argv[arg], "-height") == 0) {
height = atoi(argv[++arg]);
} else if (strcmp(argv[arg], "-display") == 0) {
sprintf(display, "DISPLAY=%s", argv[++arg]);
} else if (strcmp(argv[arg], "-nologdebug") == 0) {
diag_level &= ICET_DIAG_WARNINGS | ICET_DIAG_ALL_NODES;
} else if (strcmp(argv[arg], "-redirect") == 0) {
redirect = 1;
} else if (strcmp(argv[arg], "-h") == 0) {
usage(argv);
exit(0);
} else if ( (strcmp(argv[arg], "-R") == 0)
|| (strncmp(argv[arg], "-", 1) != 0) ) {
break;
} else if (strcmp(argv[arg], "--") == 0) {
arg++;
break;
} else {
printf("Unknown options `%s'. Try -h for help.\n", argv[arg]);
exit(1);
}
if (strcmp(argv[arg], "-width") == 0) {
width = atoi(argv[++arg]);
} else if (strcmp(argv[arg], "-height") == 0) {
height = atoi(argv[++arg]);
} else if (strcmp(argv[arg], "-display") == 0) {
sprintf(display, "DISPLAY=%s", argv[++arg]);
} else if (strcmp(argv[arg], "-nologdebug") == 0) {
diag_level &= ICET_DIAG_WARNINGS | ICET_DIAG_ALL_NODES;
} else if (strcmp(argv[arg], "-redirect") == 0) {
redirect = 1;
} else if (strcmp(argv[arg], "-h") == 0) {
usage(argv);
exit(0);
} else if ( (strcmp(argv[arg], "-R") == 0)
|| (strncmp(argv[arg], "-", 1) != 0) ) {
break;
} else if (strcmp(argv[arg], "--") == 0) {
arg++;
break;
} else {
printf("Unknown options `%s'. Try -h for help.\n", argv[arg]);
exit(1);
}
}
/* Fix arguments for next bout of parsing. */
*argcp = 1;
for ( ; arg < argc; arg++, (*argcp)++) {
argv[*argcp] = argv[arg];
argv[*argcp] = argv[arg];
}
argc = *argcp;
/* Make sure selected options are consistent. */
if ((num_proc > 1) && (argc < 2)) {
printf("You must select a test on the command line when using more than one process.\n");
printf("Try -h for help.\n");
exit(1);
printf("You must select a test on the command line when using more than one process.\n");
printf("Try -h for help.\n");
exit(1);
}
if (redirect && (argc < 2)) {
printf("You must select a test on the command line when redirecting the output.\n");
printf("Try -h for help.\n");
exit(1);
printf("You must select a test on the command line when redirecting the output.\n");
printf("Try -h for help.\n");
exit(1);
}
/* Create a renderable window. */
......@@ -194,22 +195,22 @@ void initialize_test(int *argcp, char ***argvp, IceTCommunicator comm)
/* Redirect standard output on demand. */
if (redirect) {
char filename[64];
int outfd;
if (rank == 0) {
realstdout = fdopen(dup(1), "wt");
} else {
realstdout = NULL;
}
sprintf(filename, "log.%04d", rank);
outfd = open(filename, O_WRONLY | O_CREAT | O_APPEND, 0644);
if (outfd < 0) {
printf("Could not open %s for writing.\n", filename);
exit(1);
}
dup2(outfd, 1);
char filename[64];
int outfd;
if (rank == 0) {
realstdout = fdopen(dup(1), "wt");
} else {
realstdout = NULL;
}
sprintf(filename, "log.%04d", rank);
outfd = open(filename, O_WRONLY | O_CREAT | O_APPEND, 0644);
if (outfd < 0) {
printf("Could not open %s for writing.\n", filename);
exit(1);
}
dup2(outfd, 1);
} else {
realstdout = stdout;
realstdout = stdout;
}
strategy_list[0] = ICET_STRATEGY_DIRECT;
......@@ -220,11 +221,31 @@ void initialize_test(int *argcp, char ***argvp, IceTCommunicator comm)
}
extern void finalize_communication(void);
void finalize_test(void)
void finalize_test(int result)
{
GLint rank;
checkOglError();
checkIceTError();
icetGetIntegerv(ICET_RANK, &rank);
if (rank == 0) {
switch (result) {
case TEST_PASSED:
printf("***Test Passed***\n");
break;
case TEST_NOT_RUN:
printf("***TEST NOT RUN***\n");
break;
case TEST_NOT_PASSED:
printf("***TEST NOT PASSED***\n");
break;
case TEST_FAILED:
printf("***TEST FAILED***\n");
break;
}
}
icetDestroyContext(context);
finalize_communication();
}
......@@ -30,11 +30,11 @@ extern int SCREEN_HEIGHT;
void initialize_test(int *argcp, char ***argvp, IceTCommunicator comm);
void finalize_test(void);
void finalize_test(int result);
void write_ppm(const char *filename,
const GLubyte *image,
int width, int height);
const GLubyte *image,
int width, int height);
#ifdef __cplusplus
}
......
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