3 * Copyright (C) 2010 Joel Rosdahl
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 3 of the License, or (at your option)
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "test/framework.h"
21 #ifdef HAVE_GETOPT_LONG
24 #include "getopt_long.h"
27 #define SUITE(name) unsigned suite_##name(unsigned);
28 #include "test/suites.h"
31 const char USAGE_TEXT[] =
36 " -h, --help print this help text\n"
37 " -v, --verbose enable verbose logging of tests\n";
40 main(int argc, char **argv)
43 #define SUITE(name) &suite_##name,
44 #include "test/suites.h"
48 static const struct option options[] = {
49 {"help", no_argument, NULL, 'h'},
50 {"verbose", no_argument, NULL, 'v'},
55 char *testdir, *dir_before;
58 while ((c = getopt_long(argc, argv, "hv", options, NULL)) != -1) {
61 fprintf(stdout, USAGE_TEXT);
69 fprintf(stderr, USAGE_TEXT);
74 if (getenv("RUN_FROM_BUILD_FARM")) {
78 testdir = format("testdir.%d", (int)getpid());
79 cct_create_fresh_dir(testdir);
80 dir_before = gnu_getcwd();
82 result = cct_run(suites, verbose);
84 cct_chdir(dir_before);