Beispiel #1
0
int main(int argc, char **argv)
{
	int lc;			/* loop counter */
	char *msg;		/* message returned from parse_opts */

	/* parse standard options */
	if ((msg = parse_opts(argc, argv, (option_t *) NULL, NULL)) !=
	    (char *)NULL) {
		tst_brkm(TBROK, tst_exit, "OPTION PARSING ERROR - %s", msg);
	}

	setup();

	/* check looping state if -i option is given */
	for (lc = 0; TEST_LOOPING(lc); lc++) {
		/* reset Tst_count in case we are looping */
		Tst_count = 0;

		for (testno = 0; testno < TST_TOTAL; ++testno) {

			TEST(setresgid(*tdat[testno].rgid, *tdat[testno].egid,
				       *tdat[testno].sgid));

			TEST_ERROR_LOG(TEST_ERRNO);
			if ((TEST_RETURN == EXP_RET_VAL) &&
			    (TEST_ERRNO == EXP_ERRNO)) {

				if (!test_functionality
				    (tdat[testno].exp_rgid->pw_gid,
				     tdat[testno].exp_egid->pw_gid,
				     tdat[testno].exp_sgid->pw_gid)) {

					tst_resm(TPASS, "setresgid() failed as "
						 "expected for %s : errno %d",
						 TEST_DESC, TEST_ERRNO);
				} else {
					tst_resm(TFAIL, "Functionality test "
						 "for setresgid() for %s failed",
						 TEST_DESC);
				}

			} else {
				tst_resm(TFAIL, "setresgid() returned "
					 "unexpected results for %s ; returned"
					 " %ld (expected %d), errno %d (expected"
					 " %d)", TEST_DESC,
					 TEST_RETURN, EXP_RET_VAL, TEST_ERRNO,
					 EXP_ERRNO);
			}
		}
	}
	cleanup();

	 /*NOTREACHED*/ return 0;
}
int
ACE_TMAIN (int, ACE_TCHAR *[])
{
  for (int i = 0; timer_queues[i].name_ != 0; i++)
    {
      test_functionality (timer_queues[i].queue_);
      delete timer_queues[i].queue_;
    }

  return 0;
}
Beispiel #3
0
int main(int argc, char **argv)
{
	int lc;
	char *msg;

	if ((msg = parse_opts(argc, argv, NULL, NULL)) != NULL) {
		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
	}

	setup();

	for (lc = 0; TEST_LOOPING(lc); lc++) {
		/* reset Tst_count in case we are looping */
		Tst_count = 0;

		for (testno = 0; testno < TST_TOTAL; ++testno) {

			TEST(setresgid(*tdat[testno].rgid, *tdat[testno].egid,
				       *tdat[testno].sgid));

			TEST_ERROR_LOG(TEST_ERRNO);
			if ((TEST_RETURN == EXP_RET_VAL) &&
			    (TEST_ERRNO == EXP_ERRNO)) {

				if (!test_functionality
				    (tdat[testno].exp_rgid->pw_gid,
				     tdat[testno].exp_egid->pw_gid,
				     tdat[testno].exp_sgid->pw_gid)) {

					tst_resm(TPASS, "setresgid() failed as "
						 "expected for %s : errno %d",
						 TEST_DESC, TEST_ERRNO);
				} else {
					tst_resm(TFAIL, "Functionality test "
						 "for setresgid() for %s failed",
						 TEST_DESC);
				}

			} else {
				tst_resm(TFAIL, "setresgid() returned "
					 "unexpected results for %s ; returned"
					 " %ld (expected %d), errno %d (expected"
					 " %d)", TEST_DESC,
					 TEST_RETURN, EXP_RET_VAL, TEST_ERRNO,
					 EXP_ERRNO);
			}
		}
	}
	cleanup();

	tst_exit();
}
Beispiel #4
0
int main(int argc, char **argv)
{
	int lc;
	const char *msg;

	if ((msg = parse_opts(argc, argv, NULL, NULL)) != NULL) {
		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
	}

	setup();

	for (lc = 0; TEST_LOOPING(lc); lc++) {
		/* reset tst_count in case we are looping */
		tst_count = 0;

		for (testno = 0; testno < TST_TOTAL; ++testno) {

			TEST(SETRESGID(cleanup, *tdat[testno].rgid, *tdat[testno].egid,
				       *tdat[testno].sgid));

			if (TEST_RETURN == EXP_RET_VAL) {
				if (!test_functionality
				    (tdat[testno].exp_rgid->pw_gid,
				     tdat[testno].exp_egid->pw_gid,
				     tdat[testno].exp_sgid->pw_gid)) {

					tst_resm(TPASS, "Test for %s "
						 "successful",
						 tdat[testno].desc);
				} else {
					tst_resm(TFAIL, "Functionality test "
						 "for %s failed",
						 tdat[testno].desc);
				}
			} else {
				tst_resm(TFAIL, "Test for %s failed; returned"
					 " %ld (expected %d), errno %d (expected"
					 " 0)", tdat[testno].desc,
					 TEST_RETURN, EXP_RET_VAL, TEST_ERRNO);
			}
		}
	}
	cleanup();

	tst_exit();
}
Beispiel #5
0
int
run_main (int argc, ACE_TCHAR *argv[])
{
  ACE_START_TEST (ACE_TEXT ("Timer_Queue_Test"));

  if (argc > 1)
    max_iterations = ACE_OS::atoi (argv[1]);

  // = Perform initializations.

  Timer_Queue_Stack *tq_stack = 0;

  // Add new Timer_Queue implementations here.  Note that these will
  // be executed in "reverse order".

  // Timer_Hash (Heap)
  ACE_NEW_RETURN (tq_stack,
                  Timer_Queue_Stack (new ACE_Timer_Hash_Heap,
                                     ACE_TEXT ("ACE_Timer_Hash (Heap)"),
                                     tq_stack),
                  -1);

  // Timer_Hash
  ACE_NEW_RETURN (tq_stack,
                  Timer_Queue_Stack (new ACE_Timer_Hash,
                                     ACE_TEXT ("ACE_Timer_Hash"),
                                     tq_stack),
                  -1);

  // Timer_stack
  ACE_NEW_RETURN (tq_stack,
                  Timer_Queue_Stack (new ACE_Timer_List,
                                     ACE_TEXT ("ACE_Timer_List"),
                                     tq_stack),
                  -1);

  // Timer_Wheel without preallocated memory
  ACE_NEW_RETURN (tq_stack,
                  Timer_Queue_Stack (new ACE_Timer_Wheel,
                                     ACE_TEXT ("ACE_Timer_Wheel (non-preallocated)"),
                                     tq_stack),
                  -1);

  // Timer_Wheel with preallocated memory.
  ACE_NEW_RETURN (tq_stack,
                  Timer_Queue_Stack (new ACE_Timer_Wheel (ACE_DEFAULT_TIMER_WHEEL_SIZE,
                                                          ACE_DEFAULT_TIMER_WHEEL_RESOLUTION,
                                                          max_iterations),
                                     ACE_TEXT ("ACE_Timer_Wheel (preallocated)"),
                                     tq_stack),
                  -1);
  // Timer_Heap without preallocated memory.
  ACE_NEW_RETURN (tq_stack,
                  Timer_Queue_Stack (new ACE_Timer_Heap,
                                     ACE_TEXT ("ACE_Timer_Heap (non-preallocated)"),
                                     tq_stack),
                  -1);

  // Timer_Heap with preallocate memory.
  ACE_NEW_RETURN (tq_stack,
                  Timer_Queue_Stack (new ACE_Timer_Heap (max_iterations, 1),
                                     ACE_TEXT ("ACE_Timer_Heap (preallocated)"),
                                     tq_stack),
                  -1);

  // Timer_Heap without preallocated memory, using high-res time.
  // @deprecated
  (void) ACE_High_Res_Timer::global_scale_factor ();

  ACE_Timer_Heap *tq_heap =
    new ACE_Timer_Heap;
  tq_heap->gettimeofday(&ACE_High_Res_Timer::gettimeofday_hr);
  ACE_NEW_RETURN (tq_stack,
                  Timer_Queue_Stack (tq_heap,
                                     ACE_TEXT ("ACE_Timer_Heap (high-res timer; deprecated version)"),
                                     tq_stack),
                  -1);

  // new (optimized) version
  typedef ACE_Timer_Heap_T<ACE_Event_Handler *,
                           ACE_Event_Handler_Handle_Timeout_Upcall,
                           ACE_SYNCH_RECURSIVE_MUTEX,
                           ACE_HR_Time_Policy>
          timer_heap_hr_type;
  ACE_NEW_RETURN (tq_stack,
                  Timer_Queue_Stack (new timer_heap_hr_type,
                                     ACE_TEXT ("ACE_Timer_Heap (high-res timer)"),
                                     tq_stack),
                  -1);


  // Create the Timer ID array
  ACE_NEW_RETURN (timer_ids,
                  long[max_iterations],
                  -1);

  Timer_Queue_Stack *tq_ptr = tq_stack;

  while (tq_ptr != 0)
    {
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("**** starting test of %s\n"),
                  tq_ptr->name_));
      test_interval_timer (tq_ptr->queue_);
      test_functionality (tq_ptr->queue_);
      test_performance (tq_ptr->queue_,
                        tq_ptr->name_);
      delete tq_ptr->queue_;
      Timer_Queue_Stack *temp = tq_ptr;
      tq_ptr = tq_ptr->next_;
      delete temp;
    }
  delete [] timer_ids;

  ACE_DEBUG
    ((LM_DEBUG,
      ACE_TEXT ("**** starting unique IDs test for ACE_Timer_Heap\n")));
  test_unique_timer_heap_ids ();

  ACE_END_TEST;
  return 0;
}