Example #1
0
void test33d()
{				/* Test access() flags. */
#define EXCLUDE(a,b)	(((a)^(b)) == ((a)|(b)))
  subtest = 4;
  System("rm -rf ../DIR_33/*");

  /* The test are rather strong, stronger that POSIX specifies. */
  /* The should be OR able, this test tests if all the 1 bits */
  /* Are in diferent places. This should be what one wants. */
  if (!EXCLUDE(R_OK, W_OK | X_OK)) e(1);
  if (!EXCLUDE(W_OK, R_OK | X_OK)) e(2);
  if (!EXCLUDE(X_OK, R_OK | W_OK)) e(3);
  if (F_OK == R_OK) e(4);
  if (F_OK == W_OK) e(5);
  if (F_OK == X_OK) e(6);
  if (F_OK == (R_OK | W_OK)) e(7);
  if (F_OK == (W_OK | X_OK)) e(8);
  if (F_OK == (R_OK | X_OK)) e(9);
  if (F_OK == (R_OK | W_OK | X_OK)) e(10);
}
Example #2
0
void test25a()
{				/* Test fcntl flags. */
  subtest = 1;

#define EXCLUDE(a,b)	(((a)^(b)) == ((a)|(b)))
#define ADDIT		(O_APPEND | O_CREAT | O_EXCL | O_NONBLOCK | O_TRUNC)

  /* If this compiles all flags are defined but they have to be or-able. */
  if (!(EXCLUDE(O_NONBLOCK, O_TRUNC))) e(1);
  if (!(EXCLUDE(O_EXCL, O_NONBLOCK | O_TRUNC))) e(2);
  if (!(EXCLUDE(O_CREAT, O_EXCL | O_NONBLOCK | O_TRUNC))) e(3);
  if (!(EXCLUDE(O_APPEND, O_CREAT | O_EXCL | O_NONBLOCK | O_TRUNC))) e(4);
  if (!(EXCLUDE(O_RDONLY, ADDIT))) e(5);
  if (!(EXCLUDE(O_WRONLY, ADDIT))) e(6);
  if (!(EXCLUDE(O_RDWR, ADDIT))) e(7);
}