"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/unit/main.c" between
vfplot-1.0.14.tar.gz and vfplot-1.0.15.tar.gz

About: vfplot is a program for plotting two-dimensional vector fields (supporting Gerris) fluid flows simulation files).

main.c  (vfplot-1.0.14):main.c  (vfplot-1.0.15)
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <CUnit/Basic.h> #include <CUnit/Basic.h>
#include "tests.h" #include "tests.h"
#define NO_STDERR #define NO_STDERR
#ifdef NO_STDERR
#include <fcntl.h>
#include <unistd.h>
#endif
int main(void) int main(void)
{ {
CU_BasicRunMode mode = CU_BRM_VERBOSE; CU_BasicRunMode mode = CU_BRM_VERBOSE;
CU_ErrorAction error_action = CUEA_IGNORE; CU_ErrorAction error_action = CUEA_IGNORE;
setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0);
if (CU_initialize_registry()) if (CU_initialize_registry())
{ {
fprintf(stderr,"failed to initialise registry\n"); fprintf(stderr,"failed to initialise registry\n");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
tests_load(); tests_load();
CU_basic_set_mode(mode); CU_basic_set_mode(mode);
CU_set_error_action(error_action);
#ifdef NO_STDERR #ifdef NO_STDERR
if (freopen("/dev/null", "w", stderr) == NULL) int devnull = open("/dev/null", O_RDWR|O_CREAT|O_APPEND, 0600);
int save_err = dup(fileno(stderr));
if (dup2(devnull, fileno(stderr)) == -1)
{ {
printf("failed to redirect stderr\n"); printf("failed to redirect stderr\n");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
#endif #endif
int status = CU_basic_run_tests(); int status = CU_basic_run_tests();
#ifdef NO_STDERR #ifdef NO_STDERR
if (freopen("/dev/stderr", "w", stderr) == NULL) fflush(stderr);
{ close(devnull);
printf("failed to redirect stderr back\n");
return EXIT_FAILURE; dup2(save_err, fileno(stderr));
} close(save_err);
#endif #endif
CU_set_error_action(error_action); int nfail = CU_get_number_of_failures();
printf("\nSuite returned %d.\n", status);
printf("\nSuite %s: %d failed\n",
(status == 0 ? "OK" : "errored"),
nfail);
CU_cleanup_registry(); CU_cleanup_registry();
return (CU_get_number_of_failures() > 0 ? EXIT_FAILURE : EXIT_SUCCESS); return (nfail > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
} }
 End of changes. 6 change blocks. 
9 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)