Configuration Guide - gavinfielder/pft GitHub Wiki
Most PFT Configuration can be done by editing options-config.ini
.
While PFT has plenty of options, these two options play the biggest role:
DEFAULT_RUN_OPTIONS
, which sets the command line options that are selected by default.TEST_OUTDATED_TIME
, which sets a threshold for tests becoming classified as 'outdated', which can affect which tests are run by default.
This page holds some suggested configurations and how-to's. If you're looking for more of a reference, see Run Options and Configuration Options for lists of options.
The Default Configuration
The default configuration is intended to offer the most intuitive and flexible configuration, work with any ft_printf project, and minimize the chance for incoherent behavior.
- Test history log information is shown but test status does not factor into which tests are run unless command line options specify a filter
- The test outdated time is 15 minutes, which may or may not be a reasonable timeframe for someone to break code that was previously working.
I like to make small changes and test a lot, but I want to ignore all these tests I just passed a few seconds ago
Remove p
(after the =
) from DEFAULT_RUN_OPTIONS
and shorten TEST_OUTDATED_TIME
to something faster, like 120 seconds.
- Any test that passed less than 2 minutes ago will not be run unless you specify
+p
as a command line option.
Why 15 minutes? I'd like to see if it passed yesterday, at least...
Set TEST_OUTDATED_TIME
to 172800.
- The test history information will say 'passed' or 'failed' (whichever was more recent) for tests that ran anytime in the last two days.
- The
-=no
filter option will select tests that are either two days old or have no history.
I don't care about test history and I don't want it cluttering my screen
Change the l
to L
in the DEFAULT_RUN_OPTIONS
. You can also remove the =nopf
, but it won't do anything when L
(test history logging off) is selected.
I want to run leaks test every time
Change the K
to k
in the DEFAULT_RUN_OPTIONS
. (Note this disables timeouts, so any infinite loop in your code will hang PFT.)
I want to have more control over my test history
Change the w
to W
in the DEFAULT_RUN_OPTIONS
. The history will be read, but will not be written unless you specify -w
at run time.
My test history keeps disappearing. Can I make it persistent?
Setting REMOVE_HISTORY_WHEN_TESTS_NEW
to 0
will disable automatic removals of the test history. This is completely safe as long as you never add your own tests.
This is not recommended when you want to be able to add your own tests, as the test numbers can change and the log will become corrupted. If you want to be able to both add tests and enable/disable tests with a more persistent test history, you can instead set ENABLE_DISABLE_TOUCHES_TEST_HISTORY
to 1
, which will prevent the enable/disable from triggering a history removal.
I like PFT but I feel like writing all my own tests
Sure, delete them all and start from scratch. You can also consider setting SINGLE_NUMBER_SINGLE_TEST
to 0
, which will make ./test 42
, instead of running just one test, run test #42 to the end of all the enabled tests., which could make testing faster if you simply write tests as you go. This was the behavior of the tester when I developed my ft_printf.