HIPC  0.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
test_session_err.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <assert.h>
5 
6 #include <hipc/session.h>
7 
8 int main(int argc, char *argv[])
9 {
10  hipc_session clio;
11 
12  if (2 != argc) {
13  fprintf(stderr, "Usage: %s test_id\n", argv[0]);
14  exit(EXIT_FAILURE);
15  }
16 
17  clio.cl.std_errno = 0;
18  clio.cl.hipc_errno = HIPC_SUCCESS;
19  clio.cl.err_detail_str[0] = '\0';
20 
21  switch (argv[1][0]) {
22  case 'a':
23  HIPC_ERRCHECK(&clio);
24  break;
25  case 'b':
27  HIPC_ERRCHECK(&clio);
28  break;
29  case 'c':
30  clio.cl.hipc_errno = HIPC_N_ERR;
31  HIPC_ERRCHECK(&clio);
32  break;
33  case 'd':
35  strcpy(clio.cl.err_detail_str, "Mock error by test_client_err");
36  HIPC_ERRCHECK(&clio);
37  break;
38  case 'e':
40  clio.cl.std_errno = 1;
41  HIPC_ERRCHECK(&clio);
42  break;
43  case 'f':
44  HIPC_ERRCHECK(NULL);
45  break;
46  default:
47  fprintf(stderr, "Invalid test_id: %s \n", argv[1]);
48  exit(EXIT_FAILURE);
49  }
50 
51  return 0;
52 }
int std_errno
Definition: client.h:84
char err_detail_str[HIPC_IMG_ALLOCSIZE]
Definition: client.h:86
int main(int argc, char *argv[])
enum HIPC_errno hipc_errno
Definition: client.h:85
struct HIPC_client cl
Definition: session.h:15
#define HIPC_ERRCHECK(sess_p)
Checks whether an error has occurred.
Definition: session.h:72