Criterion/include/criterion/options.h

195 lines
4.6 KiB
C
Raw Permalink Normal View History

2015-03-09 20:16:50 +01:00
/*
* The MIT License (MIT)
*
2016-01-01 00:00:00 +01:00
* Copyright © 2015-2016 Franklin "Snaipe" Mathieu <http://snai.pe/>
2015-03-09 20:16:50 +01:00
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @file
* @brief criterion options
*****************************************************************************/
2015-03-09 20:15:00 +01:00
#ifndef CRITERION_OPTIONS_H_
#define CRITERION_OPTIONS_H_
2015-03-09 20:15:00 +01:00
#include <stdbool.h>
#include "logging.h"
#include "internal/common.h"
2015-03-09 20:15:00 +01:00
2016-08-23 21:46:14 +02:00
enum criterion_debugger {
/**
* Do not run the underlying test in a debugger
*/
CR_DBG_NONE,
/**
* Run the test suspended, without a debugger, and print its PID.
*
* Allows external debuggers to attach.
*/
CR_DBG_IDLE,
2016-08-23 21:46:14 +02:00
/**
* Run the test with a debugging server compatible with the compiler
* it was built with.
*/
CR_DBG_NATIVE,
/**
* Run the test with gdbserver
*/
CR_DBG_GDB,
/**
* Run the test with lldb-server
*/
CR_DBG_LLDB,
/**
* Run the test with windbg in server mode
*/
CR_DBG_WINDBG,
};
2015-03-09 20:15:00 +01:00
struct criterion_options {
2015-12-08 00:34:02 +01:00
/**
* The current logging threshold.
*
* default: 1
*/
2015-03-09 20:15:00 +01:00
enum criterion_logging_level logging_threshold;
2015-12-08 00:34:02 +01:00
/**
* The logger that will be used during the execution of the runner.
*
* default: normal logger
*/
struct criterion_logger *logger;
2015-12-08 00:34:02 +01:00
/**
2016-09-03 16:05:53 +02:00
* This option doesn't do anything and is deprecated.
2015-12-08 00:34:02 +01:00
*/
2015-03-09 20:15:00 +01:00
bool no_early_exit;
2015-12-08 00:34:02 +01:00
/**
* Always return a success from criterion_run_all_tests.
*
* default: false
*/
2015-03-09 20:15:00 +01:00
bool always_succeed;
2015-12-08 00:34:02 +01:00
/**
* Disable unicode and ansi coloring from the logging system.
*
* default: false
*/
2015-03-22 21:23:14 +01:00
bool use_ascii;
2015-12-08 00:34:02 +01:00
/**
* Exit immediately after the first test failure.
*
* default: false
*/
2015-03-22 21:32:44 +01:00
bool fail_fast;
2015-12-08 00:34:02 +01:00
/**
* Disable all tests not matching this extglob pattern.
* if NULL, don't filter tests.
*
* default: NULL
*/
const char *pattern;
2015-12-08 00:34:02 +01:00
/**
* Only print the base file name compound of the source file containing
* the tests during reporting.
*
* default: false
*/
bool short_filename;
2015-12-08 00:34:02 +01:00
/**
* The maximum number of parallel jobs that the test runner will spawn.
* 0 means that this number shall be the number of cores on your system.
*
* default: 0
*/
size_t jobs;
2015-12-08 00:34:02 +01:00
/**
* Measure and report times.
*
* default: true
*/
bool measure_time;
2016-01-12 00:17:03 +01:00
/**
* Whether criterion should wait for incoming connections in server mode
*
* default: false
*/
bool wait_for_clients;
/**
* Raise a debug trap to crash the test if an assert fails so that a
* debugger can gain control.
*
* default: false
*/
bool crash;
2016-08-23 21:46:14 +02:00
/**
* Whether criterion should run its tests in a debugging server.
*
* The server hangs until a connection from a debugger gets accepted.
*
* This forces jobs = 1 and crash = true.
*
* default: CR_DBG_NONE;
*/
enum criterion_debugger debug;
/**
* The TCP port of the debugging server.
*
* default: 1234
*/
unsigned debug_port;
2016-09-04 21:06:25 +02:00
/**
* The default timeout for each test when none is specified, in seconds.
*
* If the value is non-positive, no timeout is applied.
*
* default: 0
*/
double timeout;
2015-03-09 20:15:00 +01:00
};
2015-09-07 01:15:31 +02:00
CR_BEGIN_C_API
2015-12-08 00:34:02 +01:00
/**
* The runtime options for the test runner.
*/
2016-08-31 16:51:19 +02:00
CR_API extern struct criterion_options criterion_options;
2015-03-09 20:15:00 +01:00
2015-09-07 01:15:31 +02:00
CR_END_C_API
2015-03-09 20:15:00 +01:00
#endif /*!CRITERION_OPTIONS_H_ */