Apache HTTPD
testsleep.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "time.h"
18#include "apr_thread_proc.h"
19#include "apr_errno.h"
20#include "apr_general.h"
21#include "apr_lib.h"
22#include <stdio.h>
23#include <stdlib.h>
24#include "testutil.h"
25
26#define SLEEP_INTERVAL 5
27
28static void sleep_one(abts_case *tc, void *data)
29{
30 time_t pretime = time(NULL);
33
35 posttime = time(NULL);
36
37 /* normalize the timediff. We should have slept for SLEEP_INTERVAL, so
38 * we should just subtract that out.
39 */
41 ABTS_TRUE(tc, timediff >= 0);
42 ABTS_TRUE(tc, timediff <= 1);
43}
44
46{
47 suite = ADD_SUITE(suite)
48
50
51 return suite;
52}
53
void abts_run_test(abts_suite *ts, test_func f, void *value)
Definition abts.c:175
#define ABTS_TRUE(a, b)
Definition abts.h:127
#define ADD_SUITE(suite)
Definition abts.h:67
APR Error Codes.
APR Miscellaneous library routines.
APR general purpose library routines.
APR Thread and Process Library.
apr_size_t size
void * data
#define apr_time_from_sec(sec)
Definition apr_time.h:78
return NULL
Definition mod_so.c:359
abts_suite * testsleep(abts_suite *suite)
Definition testsleep.c:45
static void sleep_one(abts_case *tc, void *data)
Definition testsleep.c:28
#define SLEEP_INTERVAL
Definition testsleep.c:26