summaryrefslogtreecommitdiff
path: root/PACE/tests/Posix_SP_Test.c
blob: efb47edbfe30f69a6f43086c79304607c1e5a1de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* $Id$ -*- C -*- */

/* ===================================================================== */
/*                                                                       */
/* = FILENAME                                                            */
/*    Posix_SP_Test.c                                                    */
/*                                                                       */
/* =  DESCRIPTION                                                        */
/*     Testing the platform for POSIX_SINGLE_PROCESS unit of             */
/*     functionality. This consists of calls to sysconf, time, and       */
/*     uname. This is not meant to be an exhaustive test at this         */
/*     point but more a sanity check that PACE works (at least somewhat) */
/*     as advertised.                                                    */
/*                                                                       */
/* = AUTHOR                                                              */
/*    Joe Hoffert <joeh@cs.wustl.edu>                                    */
/*                                                                       */
/* ===================================================================== */

#include "pace/unistd.h"
#include "pace/time.h"
#include "pace/sys/utsname.h"

const char * filename = "temp";
const char * mode = "w+";
const char * string1 = "line 1\n";
const char * success = "SUCCEEDED";
const char * failure = "***FAILED***";

int
main (int argc, char **argv)
{
  long retval;
  time_t local_time;
  struct utsname name;

  /* Call pace_sysconf() */
  retval = pace_sysconf(_SC_2_C_BIND);

  if (retval != _POSIX2_C_BIND) {
    printf("pace_sysconf %s\n", failure);
    return -1;
  }

  printf("pace_sysconf %s\n", success);

  /* Call pace_time() */
  retval = pace_time(&local_time);

  if (retval == -1) {
    printf("pace_time %s\n", failure);
    return -1;
  }

  printf("pace_time %s\n", success);

  /* Call pace_uname() */
  retval = pace_uname(&name);

  if (retval <= -1) {
    printf("pace_uname %s\n", failure);
    return -1;
  }

  printf("pace_uname %s\n", success);

  return 0;
}