This source file includes following definitions.
- main
   1 
   2 
   3 
   4 
   5 
   6 
   7 
   8 
   9 
  10 
  11 
  12 
  13 
  14 
  15 
  16 
  17 
  18 
  19 #include "ompi_config.h"
  20 
  21 #include <stdio.h>
  22 #include <string.h>
  23 #include <stdlib.h>
  24 #ifdef HAVE_SYS_PARAM_H
  25 #include <sys/param.h>
  26 #endif
  27 #ifdef HAVE_NETINET_IN_H
  28 #include <netinet/in.h>
  29 #endif
  30 #ifdef HAVE_UNISTD_H
  31 #include <unistd.h>
  32 #endif
  33 #ifdef HAVE_NETDB_H
  34 #include <netdb.h>
  35 #endif
  36 #include <errno.h>
  37 
  38 #include "opal/util/error.h"
  39 #include "opal/constants.h"
  40 #include "opal/runtime/opal.h"
  41 #include "orte/constants.h"
  42 
  43 int
  44 main(int argc, char *argv[])
  45 {
  46     int i;
  47     int errors[] = { OPAL_SUCCESS,
  48                      OPAL_ERROR,
  49                      OPAL_ERR_OUT_OF_RESOURCE,
  50                      OPAL_ERR_NOT_FOUND,
  51                      OPAL_ERR_BAD_PARAM,
  52                      OPAL_ERR_MAX + 10, 
  53                      1 }; 
  54     char buf[1024];
  55 
  56     opal_init(&argc, &argv);
  57 
  58     for (i = 0 ; errors[i] <= 0 ; ++i) {
  59         printf("--> error code: %d\n", errors[i]);
  60         opal_perror(errors[i], "perror test");
  61         printf("strerror test: %s\n", opal_strerror(errors[i]));
  62         opal_strerror_r(errors[i], buf, sizeof(buf));
  63         printf("strerror_r test: %s\n", buf);
  64     }
  65 
  66     printf("--> error in errno test\n");
  67     errno = EINVAL;
  68     opal_perror(OPAL_ERR_IN_ERRNO, "perror test");
  69     errno = EINVAL;
  70     printf("strerror test: %s\n", opal_strerror(OPAL_ERR_IN_ERRNO));
  71     errno = EINVAL;
  72     opal_strerror_r(OPAL_ERR_IN_ERRNO, buf, sizeof(buf));
  73     printf("strerror_r test: %s\n", buf);
  74 
  75     printf("--> orte error test\n");
  76     opal_perror(ORTE_ERR_BUFFER, "orte test");
  77 
  78     printf("--> orte unknown error test\n");
  79     opal_perror(ORTE_ERR_MAX + 10, "orte unknown test");
  80 
  81     printf("--> unknown error test\n");
  82     opal_perror(ORTE_ERR_MAX - 200, "unknown error");
  83 
  84     opal_finalize();
  85 
  86     return 0;
  87 }