blob: b489abc55bf6ad00cf21c1eba10399c83301981d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#ifndef RUNNER_SETTINGS_H
#define RUNNER_SETTINGS_H
#include <stdbool.h>
#include <stddef.h>
#include <sys/types.h>
#include <regex.h>
enum {
LOG_LEVEL_NORMAL = 0,
LOG_LEVEL_QUIET = -1,
LOG_LEVEL_VERBOSE = 1,
};
struct regex_list {
char **regex_strings;
regex_t** regexes;
size_t size;
};
struct settings {
bool abort_on_error;
char *test_list;
char *name;
bool dry_run;
struct regex_list include_regexes;
struct regex_list exclude_regexes;
bool sync;
int log_level;
bool overwrite;
bool multiple_mode;
int inactivity_timeout;
int overall_timeout;
bool use_watchdog;
char *test_root;
char *results_path;
bool piglit_style_dmesg;
};
/**
* init_settings:
*
* Initializes a settings object to an empty state (all values NULL, 0
* or false).
*
* @settings: Object to initialize. Storage for it must exist.
*/
void init_settings(struct settings *settings);
/**
* free_settings:
*
* Releases all allocated resources for a settings object and
* initializes it to an empty state (see #init_settings).
*
* @settings: Object to release and initialize.
*/
void free_settings(struct settings *settings);
/**
* parse_options:
*
* Parses command line options and sets the settings object to
* designated values.
*
* The function can be called again on the same settings object. The
* old values will be properly released and cleared. On a parse
* failure, the settings object will be in an empty state (see
* #init_settings) and usage instructions will be printed with an
* error message.
*
* @argc: Argument count
* @argv: Argument array. First element is the program name.
* @settings: Settings object to fill with values. Must have proper
* storage.
*
* Returns: True on successful parse, false on error.
*/
bool parse_options(int argc, char **argv,
struct settings *settings);
/**
* validate_settings:
*
* Checks the settings object against the system to see if executing
* on it can be done. Checks pathnames for existence and access
* rights. Note that this function will not check that the designated
* job listing (through a test-list file or the -t/-x flags) yields a
* non-zero amount of testing to be done. On errors, usage
* instructions will be printed with an error message.
*
* @settings: Settings object to check.
*
* Returns: True on valid settings, false on any error.
*/
bool validate_settings(struct settings *settings);
/* TODO: Better place for this */
char *absolute_path(char *path);
/**
* serialize_settings:
*
* Serializes the settings object to a file in the results_path
* directory.
*
* @settings: Settings object to serialize.
*/
bool serialize_settings(struct settings *settings);
bool read_settings(struct settings *settings, int dirfd);
#endif
|