1 // Copyright (C) 2010-2018 Joel Rosdahl
3 // This program is free software; you can redistribute it and/or modify it
4 // under the terms of the GNU General Public License as published by the Free
5 // Software Foundation; either version 3 of the License, or (at your option)
8 // This program is distributed in the hope that it will be useful, but WITHOUT
9 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 // You should have received a copy of the GNU General Public License along with
14 // this program; if not, write to the Free Software Foundation, Inc., 51
15 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 #include "framework.h"
18 #ifdef HAVE_GETOPT_LONG
21 #include "../src/getopt_long.h"
24 // *INDENT-OFF* disable uncrustify
25 #define SUITE(name) unsigned suite_ ## name(unsigned);
28 // *INDENT-ON* enable uncrustify
30 const char USAGE_TEXT[] =
35 " -h, --help print this help text\n"
36 " -v, --verbose enable verbose logging of tests\n";
39 main(int argc, char **argv)
42 #define SUITE(name) &suite_ ## name,
47 static const struct option options[] = {
48 {"help", no_argument, NULL, 'h'},
49 {"verbose", no_argument, NULL, 'v'},
54 char *testdir, *dir_before;
58 putenv("CCACHE_DETECT_SHEBANG=1");
61 while ((c = getopt_long(argc, argv, "hv", options, NULL)) != -1) {
64 fprintf(stdout, USAGE_TEXT);
72 fprintf(stderr, USAGE_TEXT);
77 if (getenv("RUN_FROM_BUILD_FARM")) {
81 testdir = format("testdir.%d", (int)getpid());
82 cct_create_fresh_dir(testdir);
83 dir_before = gnu_getcwd();
85 result = cct_run(suites, verbose);
87 cct_chdir(dir_before);