xref: /third_party/ltp/include/old/usctest.h (revision f08c3bdf)
1f08c3bdfSopenharmony_ci/*
2f08c3bdfSopenharmony_ci * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3f08c3bdfSopenharmony_ci *               Author: William Roske
4f08c3bdfSopenharmony_ci *
5f08c3bdfSopenharmony_ci * This program is free software; you can redistribute it and/or modify it
6f08c3bdfSopenharmony_ci * under the terms of version 2 of the GNU General Public License as
7f08c3bdfSopenharmony_ci * published by the Free Software Foundation.
8f08c3bdfSopenharmony_ci *
9f08c3bdfSopenharmony_ci * This program is distributed in the hope that it would be useful, but
10f08c3bdfSopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of
11f08c3bdfSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12f08c3bdfSopenharmony_ci *
13f08c3bdfSopenharmony_ci * Further, this software is distributed without any warranty that it is
14f08c3bdfSopenharmony_ci * free of the rightful claim of any third person regarding infringement
15f08c3bdfSopenharmony_ci * or the like.  Any license provided herein, whether implied or
16f08c3bdfSopenharmony_ci * otherwise, applies only to this software file.  Patent licenses, if
17f08c3bdfSopenharmony_ci * any, provided herein do not apply to combinations of this program with
18f08c3bdfSopenharmony_ci * other software, or any other product whatsoever.
19f08c3bdfSopenharmony_ci *
20f08c3bdfSopenharmony_ci * You should have received a copy of the GNU General Public License along
21f08c3bdfSopenharmony_ci * with this program; if not, write the Free Software Foundation, Inc.,
22f08c3bdfSopenharmony_ci * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23f08c3bdfSopenharmony_ci *
24f08c3bdfSopenharmony_ci * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
25f08c3bdfSopenharmony_ci * Mountain View, CA  94043, or:
26f08c3bdfSopenharmony_ci *
27f08c3bdfSopenharmony_ci * http://www.sgi.com
28f08c3bdfSopenharmony_ci *
29f08c3bdfSopenharmony_ci * For further information regarding this notice, see:
30f08c3bdfSopenharmony_ci *
31f08c3bdfSopenharmony_ci * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
32f08c3bdfSopenharmony_ci */
33f08c3bdfSopenharmony_ci
34f08c3bdfSopenharmony_ci#ifndef __USCTEST_H__
35f08c3bdfSopenharmony_ci#define __USCTEST_H__
36f08c3bdfSopenharmony_ci
37f08c3bdfSopenharmony_ci/*
38f08c3bdfSopenharmony_ci * Ensure that PATH_MAX is defined
39f08c3bdfSopenharmony_ci */
40f08c3bdfSopenharmony_ci#ifndef PATH_MAX
41f08c3bdfSopenharmony_ci#ifdef MAXPATHLEN
42f08c3bdfSopenharmony_ci#define PATH_MAX  MAXPATHLEN
43f08c3bdfSopenharmony_ci#else
44f08c3bdfSopenharmony_ci#define PATH_MAX  1024
45f08c3bdfSopenharmony_ci#endif
46f08c3bdfSopenharmony_ci#endif
47f08c3bdfSopenharmony_ci
48f08c3bdfSopenharmony_ci/***********************************************************************
49f08c3bdfSopenharmony_ci * The following globals are defined in parse_opts.c but must be
50f08c3bdfSopenharmony_ci * externed here because they are used in the macros defined below.
51f08c3bdfSopenharmony_ci ***********************************************************************/
52f08c3bdfSopenharmony_ciextern int STD_LOOP_COUNT; /* changed by -in to set loop count to n */
53f08c3bdfSopenharmony_ci
54f08c3bdfSopenharmony_ciextern long TEST_RETURN;
55f08c3bdfSopenharmony_ciextern int TEST_ERRNO;
56f08c3bdfSopenharmony_ci
57f08c3bdfSopenharmony_ci/***********************************************************************
58f08c3bdfSopenharmony_ci * TEST: calls a system call
59f08c3bdfSopenharmony_ci *
60f08c3bdfSopenharmony_ci * parameters:
61f08c3bdfSopenharmony_ci *	SCALL = system call and parameters to execute
62f08c3bdfSopenharmony_ci *
63f08c3bdfSopenharmony_ci ***********************************************************************/
64f08c3bdfSopenharmony_ci#define TEST(SCALL) \
65f08c3bdfSopenharmony_ci	do { \
66f08c3bdfSopenharmony_ci		errno = 0; \
67f08c3bdfSopenharmony_ci		TEST_RETURN = SCALL; \
68f08c3bdfSopenharmony_ci		TEST_ERRNO = errno; \
69f08c3bdfSopenharmony_ci	} while (0)
70f08c3bdfSopenharmony_ci
71f08c3bdfSopenharmony_ci/***********************************************************************
72f08c3bdfSopenharmony_ci * TEST_VOID: calls a system call
73f08c3bdfSopenharmony_ci *
74f08c3bdfSopenharmony_ci * parameters:
75f08c3bdfSopenharmony_ci *	SCALL = system call and parameters to execute
76f08c3bdfSopenharmony_ci *
77f08c3bdfSopenharmony_ci * Note: This is IDENTICAL to the TEST() macro except that it is intended
78f08c3bdfSopenharmony_ci * for use with syscalls returning no values (void syscall()).  The
79f08c3bdfSopenharmony_ci * Typecasting nothing (void) into an unsigned integer causes compilation
80f08c3bdfSopenharmony_ci * errors.
81f08c3bdfSopenharmony_ci *
82f08c3bdfSopenharmony_ci ***********************************************************************/
83f08c3bdfSopenharmony_ci#define TEST_VOID(SCALL) do { errno = 0; SCALL; TEST_ERRNO = errno; } while (0)
84f08c3bdfSopenharmony_ci
85f08c3bdfSopenharmony_ci/***********************************************************************
86f08c3bdfSopenharmony_ci * TEST_PAUSE: Pause for SIGUSR1 if the pause flag is set.
87f08c3bdfSopenharmony_ci *	       Just continue when signal comes in.
88f08c3bdfSopenharmony_ci *
89f08c3bdfSopenharmony_ci * parameters:
90f08c3bdfSopenharmony_ci *	none
91f08c3bdfSopenharmony_ci *
92f08c3bdfSopenharmony_ci ***********************************************************************/
93f08c3bdfSopenharmony_ci#define TEST_PAUSE usc_global_setup_hook();
94f08c3bdfSopenharmony_ciint usc_global_setup_hook();
95f08c3bdfSopenharmony_ci
96f08c3bdfSopenharmony_ci/***********************************************************************
97f08c3bdfSopenharmony_ci * TEST_LOOPING now call the usc_test_looping function.
98f08c3bdfSopenharmony_ci * The function will return 1 if the test should continue
99f08c3bdfSopenharmony_ci * iterating.
100f08c3bdfSopenharmony_ci *
101f08c3bdfSopenharmony_ci ***********************************************************************/
102f08c3bdfSopenharmony_ci#define TEST_LOOPING usc_test_looping
103f08c3bdfSopenharmony_ciint usc_test_looping(int counter);
104f08c3bdfSopenharmony_ci
105f08c3bdfSopenharmony_ci#endif /* __USCTEST_H__ */
106