2 * Copyright (c) 2010 Your File System Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 struct afstest_configinfo {
28 /* Skip adding keys to the created conf dir. */
31 extern char *afstest_BuildTestConfig(struct afstest_configinfo *info);
34 extern int afstest_AddDESKeyFile(struct afsconf_dir *dir);
38 struct afstest_cmdinfo {
39 char *command; /**< command to run (as given to e.g. system()) */
40 int exit_code; /**< expected exit code */
41 const char *output; /**< expected command output */
42 int fd; /**< fd to read output from */
44 /* The following fields are not to be set by the caller; they are set when
45 * running the given command. */
46 char *fd_descr; /**< string description of 'fd' (e.g. "stdout") */
47 pid_t child; /**< child pid (after command has started) */
48 FILE *pipe_fh; /**< pipe from child (after started) */
51 extern int is_command(struct afstest_cmdinfo *cmdinfo,
52 const char *format, ...)
53 AFS_ATTRIBUTE_FORMAT(__printf__, 2, 3);
54 extern int afstest_systemlp(char *command, ...);
58 extern char *afstest_mkdtemp(void);
59 extern void afstest_rmdtemp(char *path);
60 extern char *afstest_src_path(char *path);
61 extern char *afstest_obj_path(char *path);
62 extern int afstest_file_contains(char *path, char *target);
66 extern struct rx_securityClass
67 *afstest_FakeRxkadClass(struct afsconf_dir *dir,
68 char *name, char *instance, char *realm,
69 afs_uint32 startTime, afs_uint32 endTime);
73 extern int afstest_StartVLServer(char *dirname, pid_t *serverPid);
74 extern int afstest_StopServer(pid_t serverPid);
75 extern int afstest_StartTestRPCService(const char *, pid_t, u_short, u_short,
76 afs_int32 (*proc)(struct rx_call *));
80 extern int afstest_GetUbikClient(struct afsconf_dir *dir, char *service,
82 struct rx_securityClass *secClass,
84 struct ubik_client **ubikClient);
87 extern int afstest_IsLoopbackNetworkDefault(void);
88 extern int afstest_SkipTestsIfLoopbackNetIsDefault(void);
89 extern void afstest_SkipTestsIfBadHostname(void);
90 extern void afstest_SkipTestsIfServerRunning(char *name);
91 extern afs_uint32 afstest_MyHostAddr(void);
94 extern char *afstest_GetProgname(char **argv);
95 extern char *afstest_vasprintf(const char *fmt, va_list ap);
96 extern char *afstest_asprintf(const char *fmt, ...)
97 AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);