Debian Codegraph @

lib/App/Yath/Command/ps.pm

raw
1 package App::Yath::Command::ps;
2 use strict;
3 use warnings;
4
5 our $VERSION = '1.000179';
6
7 use Term::Table();
8 use File::Spec();
9
10 use App::Yath::Util qw/find_pfile/;
11
12 use Test2::Harness::Runner::State;
13 use Test2::Harness::Util::File::JSON();
14 use Test2::Harness::Util::Queue();
15
16 use parent 'App::Yath::Command::status';
17 use Test2::Harness::Util::HashBase qw/queue/;
18
19 sub group { 'persist' }
20
21 sub summary { "Process list for the runner" }
22 sub cli_args { "" }
23
24 sub description {
25 return <<" EOT";
26 List all running processes and runner stages.
27 EOT
28 }
29
30 sub pfile_params { (no_fatal => 1) }
31
32 sub run {
33 my $self = shift;
34
35 my $data = $self->pfile_data();
36
37 my $state = Test2::Harness::Runner::State->new(
38 workdir => $self->workdir,
39 observe => 1,
40 );
41
42 $state->poll;
43
44 my @jobs;
45
46 my $stage_status = $state->stage_readiness // {};
47 for my $stage (keys %$stage_status) {
48 my $pid = $stage_status->{$stage} // next;
49 $pid = 'N/A' if $pid == 1;
50 push @jobs => [$pid, "Runner Stage", $stage];
51 }
52
53 my $running = $state->running_tasks;
54 for my $task (values %$running) {
55 my $pid = $self->get_job_pid($task->{run_id}, $task->{job_id}) // 'N/A';
56 my $file = $task->{rel_file};
57 push @jobs => [$pid, "Running Test", $file];
58 }
59
60 my $process_table = Term::Table->new(
61 collapse => 1,
62 header => [qw/pid type name/],
63 rows => [sort { $a->[0] <=> $b->[0] } @jobs],
64 );
65
66 print "\n**** Running Processes ****\n";
67 print "$_\n" for $process_table->render;
68
69 return 0;
70 }
71
72 1;
73
74 __END__
75
76 =pod
77
78 =encoding UTF-8
79
80 =head1 NAME
81
82 App::Yath::Command::ps - Process list for the runner
83
84 =head1 DESCRIPTION
85
86 List all running processes and runner stages.
87
88
89 =head1 USAGE
90
91 $ yath [YATH OPTIONS] ps [COMMAND OPTIONS]
92
93 =head2 YATH OPTIONS
94
95 =head3 Developer
96
97 =over 4
98
99 =item --dev-lib
100
101 =item --dev-lib=lib
102
103 =item -D
104
105 =item -D=lib
106
107 =item -Dlib
108
109 =item --no-dev-lib
110
111 Add paths to @INC before loading ANYTHING. This is what you use if you are developing yath or yath plugins to make sure the yath script finds the local code instead of the installed versions of the same code. You can provide an argument (-Dfoo) to provide a custom path, or you can just use -D without and arg to add lib, blib/lib and blib/arch.
112
113 Can be specified multiple times
114
115
116 =back
117
118 =head3 Environment
119
120 =over 4
121
122 =item --persist-dir ARG
123
124 =item --persist-dir=ARG
125
126 =item --no-persist-dir
127
128 Where to find persistence files.
129
130
131 =item --persist-file ARG
132
133 =item --persist-file=ARG
134
135 =item --pfile ARG
136
137 =item --pfile=ARG
138
139 =item --no-persist-file
140
141 Where to find the persistence file. The default is /{system-tempdir}/project-yath-persist.json. If no project is specified then it will fall back to the current directory. If the current directory is not writable it will default to /tmp/yath-persist.json which limits you to one persistent runner on your system.
142
143
144 =item --project ARG
145
146 =item --project=ARG
147
148 =item --project-name ARG
149
150 =item --project-name=ARG
151
152 =item --no-project
153
154 This lets you provide a label for your current project/codebase. This is best used in a .yath.rc file. This is necessary for a persistent runner.
155
156
157 =back
158
159 =head3 Finder Options
160
161 =over 4
162
163 =item --finder MyFinder
164
165 =item --finder +Test2::Harness::Finder::MyFinder
166
167 =item --no-finder
168
169 Specify what Finder subclass to use when searching for files/processing the file list. Use the "+" prefix to specify a fully qualified namespace, otherwise Test2::Harness::Finder::XXX namespace is assumed.
170
171
172 =back
173
174 =head3 Help and Debugging
175
176 =over 4
177
178 =item --show-opts
179
180 =item --no-show-opts
181
182 Exit after showing what yath thinks your options mean
183
184
185 =item --version
186
187 =item -V
188
189 =item --no-version
190
191 Exit after showing a helpful usage message
192
193
194 =back
195
196 =head3 Plugins
197
198 =over 4
199
200 =item --no-scan-plugins
201
202 =item --no-no-scan-plugins
203
204 Normally yath scans for and loads all App::Yath::Plugin::* modules in order to bring in command-line options they may provide. This flag will disable that. This is useful if you have a naughty plugin that is loading other modules when it should not.
205
206
207 =item --plugins PLUGIN
208
209 =item --plugins +App::Yath::Plugin::PLUGIN
210
211 =item --plugins PLUGIN=arg1,arg2,...
212
213 =item --plugin PLUGIN
214
215 =item --plugin +App::Yath::Plugin::PLUGIN
216
217 =item --plugin PLUGIN=arg1,arg2,...
218
219 =item -pPLUGIN
220
221 =item --no-plugins
222
223 Load a yath plugin.
224
225 Can be specified multiple times
226
227
228 =back
229
230 =head2 COMMAND OPTIONS
231
232 =head3 Cover Options
233
234 =over 4
235
236 =item --cover-aggregator ByTest
237
238 =item --cover-aggregator ByRun
239
240 =item --cover-aggregator +Custom::Aggregator
241
242 =item --cover-agg ByTest
243
244 =item --cover-agg ByRun
245
246 =item --cover-agg +Custom::Aggregator
247
248 =item --no-cover-aggregator
249
250 Choose a custom aggregator subclass
251
252
253 =item --cover-class ARG
254
255 =item --cover-class=ARG
256
257 =item --no-cover-class
258
259 Choose a Test2::Plugin::Cover subclass
260
261
262 =item --cover-dirs ARG
263
264 =item --cover-dirs=ARG
265
266 =item --cover-dir ARG
267
268 =item --cover-dir=ARG
269
270 =item --no-cover-dirs
271
272 NO DESCRIPTION - FIX ME
273
274 Can be specified multiple times
275
276
277 =item --cover-exclude-dirs ARG
278
279 =item --cover-exclude-dirs=ARG
280
281 =item --cover-exclude-dir ARG
282
283 =item --cover-exclude-dir=ARG
284
285 =item --no-cover-exclude-dirs
286
287 Directory to leave out of file coverage and coverage metrics, along with everything under it at any depth. May be specified multiple times. Wildcards are expanded when the option is parsed, so a pattern matching nothing excludes nothing. Values are word-split first, so a path containing whitespace must be quoted or backslash-escaped. A resolved path may not contain a comma.
288
289 Can be specified multiple times
290
291
292 =item --cover-exclude-private
293
294 =item --no-cover-exclude-private
295
296
297
298
299 =item --cover-files
300
301 =item --no-cover-files
302
303 Use Test2::Plugin::Cover to collect coverage data for what files are touched by what tests. Unlike Devel::Cover this has very little performance impact (About 4% difference)
304
305
306 =item --cover-from path/to/log.jsonl
307
308 =item --cover-from http://example.com/coverage
309
310 =item --cover-from path/to/coverage.jsonl
311
312 =item --no-cover-from
313
314 This can be a test log, a coverage dump (old style json or new jsonl format), or a url to any of the previous. Tests will not be run if the file/url is invalid.
315
316
317 =item --cover-from-type json
318
319 =item --cover-from-type jsonl
320
321 =item --cover-from-type log
322
323 =item --no-cover-from-type
324
325 File type for coverage source. Usually it can be detected, but when it cannot be you should specify. "json" is old style single-blob coverage data, "jsonl" is the new by-test style, "log" is a logfile from a previous run.
326
327
328 =item --cover-manager My::Coverage::Manager
329
330 =item --no-cover-manager
331
332 Coverage 'from' manager to use when coverage data does not provide one
333
334
335 =item --cover-maybe-from path/to/log.jsonl
336
337 =item --cover-maybe-from http://example.com/coverage
338
339 =item --cover-maybe-from path/to/coverage.jsonl
340
341 =item --no-cover-maybe-from
342
343 This can be a test log, a coverage dump (old style json or new jsonl format), or a url to any of the previous. Tests will continue even if the coverage file/url is invalid.
344
345
346 =item --cover-maybe-from-type json
347
348 =item --cover-maybe-from-type jsonl
349
350 =item --cover-maybe-from-type log
351
352 =item --no-cover-maybe-from-type
353
354 Same as "from_type" but for "maybe_from". Defaults to "from_type" if that is specified, otherwise auto-detect
355
356
357 =item --cover-metrics
358
359 =item --no-cover-metrics
360
361
362
363
364 =item --cover-types ARG
365
366 =item --cover-types=ARG
367
368 =item --cover-type ARG
369
370 =item --cover-type=ARG
371
372 =item --no-cover-types
373
374 NO DESCRIPTION - FIX ME
375
376 Can be specified multiple times
377
378
379 =item --cover-write
380
381 =item --cover-write=coverage.jsonl
382
383 =item --cover-write=coverage.json
384
385 =item --no-cover-write
386
387 Create a json or jsonl file of all coverage data seen during the run (This implies --cover-files).
388
389
390 =back
391
392 =head3 Display Options
393
394 =over 4
395
396 =item --color
397
398 =item --no-color
399
400 Turn color on, default is true if STDOUT is a TTY.
401
402
403 =item --hide-runner-output
404
405 =item --no-hide-runner-output
406
407 Hide output from the runner, showing only test output. (See Also truncate_runner_output)
408
409
410 =item --no-final-table
411
412 =item --no-no-final-table
413
414 When printing final results, don't use table-style display
415
416
417 =item --no-wrap
418
419 =item --no-no-wrap
420
421 Do not do fancy text-wrapping, let the terminal handle it
422
423
424 =item --progress
425
426 =item --no-progress
427
428 Toggle progress indicators. On by default if STDOUT is a TTY. You can use --no-progress to disable the 'events seen' counter and buffered event pre-display
429
430
431 =item --quiet
432
433 =item -q
434
435 =item --no-quiet
436
437 Be very quiet.
438
439 Can be specified multiple times
440
441
442 =item --renderers +My::Renderer
443
444 =item --renderers Renderer=arg1,arg2,...
445
446 =item --renderer +My::Renderer
447
448 =item --renderer Renderer=arg1,arg2,...
449
450 =item --no-renderers
451
452 Specify renderers, (Default: "Formatter=Test2"). Use "+" to give a fully qualified module name. Without "+" "Test2::Harness::Renderer::" will be prepended to your argument.
453
454 Can be specified multiple times. If the same key is listed multiple times the value lists will be appended together.
455
456
457 =item --show-times
458
459 =item -T
460
461 =item --no-show-times
462
463 Show the timing data for each job
464
465
466 =item --term-width 80
467
468 =item --term-width 200
469
470 =item --term-size 80
471
472 =item --term-size 200
473
474 =item --no-term-width
475
476 Alternative to setting $TABLE_TERM_SIZE. Setting this will override the terminal width detection to the number of characters specified.
477
478
479 =item --truncate-runner-output
480
481 =item --no-truncate-runner-output
482
483 Only show runner output that was generated after the current command. This is only useful with a persistent runner.
484
485
486 =item --verbose
487
488 =item -v
489
490 =item --no-verbose
491
492 Be more verbose
493
494 Can be specified multiple times
495
496
497 =back
498
499 =head3 Finder Options
500
501 =over 4
502
503 =item --changed path/to/file
504
505 =item --no-changed
506
507 Specify one or more files as having been changed.
508
509 Can be specified multiple times
510
511
512 =item --changed-only
513
514 =item --no-changed-only
515
516 Only search for tests for changed files (Requires a coverage data source, also requires a list of changes either from the --changed option, or a plugin that implements changed_files() or changed_diff())
517
518
519 =item --changes-diff path/to/diff.diff
520
521 =item --no-changes-diff
522
523 Path to a diff file that should be used to find changed files for use with --changed-only. This must be in the same format as `git diff -W --minimal -U1000000`
524
525
526 =item --changes-exclude-file path/to/file
527
528 =item --no-changes-exclude-file
529
530 Specify one or more files to ignore when looking at changes
531
532 Can be specified multiple times
533
534
535 =item --changes-exclude-loads
536
537 =item --no-changes-exclude-loads
538
539 Exclude coverage tests which only load changed files, but never call code from them. (default: off)
540
541
542 =item --changes-exclude-nonsub
543
544 =item --no-changes-exclude-nonsub
545
546 Exclude changes outside of subroutines (perl files only) (default: off)
547
548
549 =item --changes-exclude-opens
550
551 =item --no-changes-exclude-opens
552
553 Exclude coverage tests which only open() changed files, but never call code from them. (default: off)
554
555
556 =item --changes-exclude-pattern '(apple|pear|orange)'
557
558 =item --no-changes-exclude-pattern
559
560 Ignore files matching this pattern when looking for changes. Your pattern will be inserted unmodified into a `$file =~ m/$pattern/` check.
561
562 Can be specified multiple times
563
564
565 =item --changes-filter-file path/to/file
566
567 =item --no-changes-filter-file
568
569 Specify one or more files to check for changes. Changes to other files will be ignored
570
571 Can be specified multiple times
572
573
574 =item --changes-filter-pattern '(apple|pear|orange)'
575
576 =item --no-changes-filter-pattern
577
578 Specify a pattern for change checking. When only running tests for changed files this will limit which files are checked for changes. Only files that match this pattern will be checked. Your pattern will be inserted unmodified into a `$file =~ m/$pattern/` check.
579
580 Can be specified multiple times
581
582
583 =item --changes-include-whitespace
584
585 =item --no-changes-include-whitespace
586
587 Include changed lines that are whitespace only (default: off)
588
589
590 =item --changes-plugin Git
591
592 =item --changes-plugin +App::Yath::Plugin::Git
593
594 =item --no-changes-plugin
595
596 What plugin should be used to detect changed files.
597
598
599 =item --default-at-search ARG
600
601 =item --default-at-search=ARG
602
603 =item --no-default-at-search
604
605 Specify the default file/dir search when 'AUTHOR_TESTING' is set. Defaults to './xt'. The default AT search is only used if no files were specified at the command line
606
607 Can be specified multiple times
608
609
610 =item --default-search ARG
611
612 =item --default-search=ARG
613
614 =item --no-default-search
615
616 Specify the default file/dir search. defaults to './t', './t2', and 'test.pl'. The default search is only used if no files were specified at the command line
617
618 Can be specified multiple times
619
620
621 =item --durations file.json
622
623 =item --durations http://example.com/durations.json
624
625 =item --no-durations
626
627 Point at a json file or url which has a hash of relative test filenames as keys, and 'SHORT', 'MEDIUM', or 'LONG' as values. This will override durations listed in the file headers. An exception will be thrown if the durations file or url does not work.
628
629
630 =item --durations-threshold ARG
631
632 =item --durations-threshold=ARG
633
634 =item --Dt ARG
635
636 =item --Dt=ARG
637
638 =item --no-durations-threshold
639
640 Only fetch duration data if running at least this number of tests. Default (-j value + 1)
641
642
643 =item --exclude-file t/nope.t
644
645 =item --no-exclude-file
646
647 Exclude a file from testing
648
649 Can be specified multiple times
650
651
652 =item --exclude-list file.txt
653
654 =item --exclude-list http://example.com/exclusions.txt
655
656 =item --no-exclude-list
657
658 Point at a file or url which has a new line separated list of test file names to exclude from testing. Starting a line with a '#' will comment it out (for compatibility with Test2::Aggregate list files).
659
660 Can be specified multiple times
661
662
663 =item --exclude-pattern t/nope.t
664
665 =item --no-exclude-pattern
666
667 Exclude a pattern from testing, matched using m/$PATTERN/
668
669 Can be specified multiple times
670
671
672 =item --extension ARG
673
674 =item --extension=ARG
675
676 =item --ext ARG
677
678 =item --ext=ARG
679
680 =item --no-extension
681
682 Specify valid test filename extensions, default: t and t2
683
684 Can be specified multiple times
685
686
687 =item --maybe-durations file.json
688
689 =item --maybe-durations http://example.com/durations.json
690
691 =item --no-maybe-durations
692
693 Point at a json file or url which has a hash of relative test filenames as keys, and 'SHORT', 'MEDIUM', or 'LONG' as values. This will override durations listed in the file headers. An exception will be thrown if the durations file or url does not work.
694
695
696 =item --no-long
697
698 =item --no-no-long
699
700 Do not run tests that have their duration flag set to 'LONG'
701
702
703 =item --only-long
704
705 =item --no-only-long
706
707 Only run tests that have their duration flag set to 'LONG'
708
709
710 =item --rerun
711
712 =item --rerun=path/to/log.jsonl
713
714 =item --rerun=plugin_specific_string
715
716 =item --no-rerun
717
718 Re-Run tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
719
720
721 =item --rerun-all
722
723 =item --rerun-all=path/to/log.jsonl
724
725 =item --rerun-all=plugin_specific_string
726
727 =item --no-rerun-all
728
729 Re-Run all tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
730
731
732 =item --rerun-failed
733
734 =item --rerun-failed=path/to/log.jsonl
735
736 =item --rerun-failed=plugin_specific_string
737
738 =item --no-rerun-failed
739
740 Re-Run failed tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
741
742
743 =item --rerun-missed
744
745 =item --rerun-missed=path/to/log.jsonl
746
747 =item --rerun-missed=plugin_specific_string
748
749 =item --no-rerun-missed
750
751 Run missed tests from a previously aborted/stopped run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
752
753
754 =item --rerun-modes failed,missed,...
755
756 =item --rerun-modes all
757
758 =item --rerun-modes failed
759
760 =item --rerun-modes missed
761
762 =item --rerun-modes passed
763
764 =item --rerun-modes retried
765
766 =item --rerun-mode failed,missed,...
767
768 =item --rerun-mode all
769
770 =item --rerun-mode failed
771
772 =item --rerun-mode missed
773
774 =item --rerun-mode passed
775
776 =item --rerun-mode retried
777
778 =item --no-rerun-modes
779
780 Pick which test categories to run
781
782 Can be specified multiple times
783
784
785 =item --rerun-passed
786
787 =item --rerun-passed=path/to/log.jsonl
788
789 =item --rerun-passed=plugin_specific_string
790
791 =item --no-rerun-passed
792
793 Re-Run passed tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
794
795
796 =item --rerun-plugin Foo
797
798 =item --rerun-plugin +App::Yath::Plugin::Foo
799
800 =item --no-rerun-plugin
801
802 What plugin(s) should be used for rerun (will fallback to other plugins if the listed ones decline the value, this is just used to set an order of priority)
803
804 Can be specified multiple times
805
806
807 =item --rerun-retried
808
809 =item --rerun-retried=path/to/log.jsonl
810
811 =item --rerun-retried=plugin_specific_string
812
813 =item --no-rerun-retried
814
815 Re-Run retried tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
816
817
818 =item --search ARG
819
820 =item --search=ARG
821
822 =item --no-search
823
824 List of tests and test directories to use instead of the default search paths. Typically these can simply be listed as command line arguments without the --search prefix.
825
826 Can be specified multiple times
827
828
829 =item --show-changed-files
830
831 =item --no-show-changed-files
832
833 Print a list of changed files if any are found
834
835
836 =back
837
838 =head3 Formatter Options
839
840 =over 4
841
842 =item --formatter ARG
843
844 =item --formatter=ARG
845
846 =item --no-formatter
847
848 NO DESCRIPTION - FIX ME
849
850
851 =item --qvf
852
853 =item --no-qvf
854
855 [Q]uiet, but [V]erbose on [F]ailure. Hide all output from tests when they pass, except to say they passed. If a test fails then ALL output from the test is verbosely output.
856
857
858 =item --show-job-end
859
860 =item --no-show-job-end
861
862 Show output when a job ends. (Default: on)
863
864
865 =item --show-job-info
866
867 =item --no-show-job-info
868
869 Show the job configuration when a job starts. (Default: off, unless -vv)
870
871
872 =item --show-job-launch
873
874 =item --no-show-job-launch
875
876 Show output for the start of a job. (Default: off unless -v)
877
878
879 =item --show-run-info
880
881 =item --no-show-run-info
882
883 Show the run configuration when a run starts. (Default: off, unless -vv)
884
885
886 =back
887
888 =head3 Git Options
889
890 =over 4
891
892 =item --git-change-base master
893
894 =item --git-change-base HEAD^
895
896 =item --git-change-base df22abe4
897
898 =item --no-git-change-base
899
900 Find files changed by all commits in the current branch from most recent stopping when a commit is found that is also present in the history of the branch/commit specified as the change base.
901
902
903 =back
904
905 =head3 Help and Debugging
906
907 =over 4
908
909 =item --dummy
910
911 =item -d
912
913 =item --no-dummy
914
915 Dummy run, do not actually execute anything
916
917 Can also be set with the following environment variables: C<T2_HARNESS_DUMMY>
918
919
920 =item --help
921
922 =item -h
923
924 =item --no-help
925
926 exit after showing help information
927
928
929 =item --interactive
930
931 =item -i
932
933 =item --no-interactive
934
935 Use interactive mode, 1 test at a time, stdin forwarded to it
936
937
938 =item --keep-dirs
939
940 =item --keep_dir
941
942 =item -k
943
944 =item --no-keep-dirs
945
946 Do not delete directories when done. This is useful if you want to inspect the directories used for various commands.
947
948
949 =item --procname-prefix ARG
950
951 =item --procname-prefix=ARG
952
953 =item --no-procname-prefix
954
955 Add a prefix to all proc names (as seen by ps).
956
957
958 =item --summary
959
960 =item --summary=/path/to/summary.json
961
962 =item --no-summary
963
964 Write out a summary json file, if no path is provided 'summary.json' will be used. The .json extension is added automatically if omitted.
965
966
967 =back
968
969 =head3 Logging Options
970
971 =over 4
972
973 =item --bzip2
974
975 =item --bz2
976
977 =item --bzip2_log
978
979 =item -B
980
981 =item --no-bzip2
982
983 Use bzip2 compression when writing the log. This option implies -L. The .bz2 prefix is added to log file name for you
984
985
986 =item --gzip
987
988 =item --gz
989
990 =item --gzip_log
991
992 =item -G
993
994 =item --no-gzip
995
996 Use gzip compression when writing the log. This option implies -L. The .gz prefix is added to log file name for you
997
998
999 =item --log
1000
1001 =item -L
1002
1003 =item --no-log
1004
1005 Turn on logging
1006
1007
1008 =item --log-dir ARG
1009
1010 =item --log-dir=ARG
1011
1012 =item --no-log-dir
1013
1014 Specify a log directory. Will fall back to the system temp dir.
1015
1016
1017 =item --log-file ARG
1018
1019 =item --log-file=ARG
1020
1021 =item -F ARG
1022
1023 =item -F=ARG
1024
1025 =item --no-log-file
1026
1027 Specify the name of the log file. This option implies -L.
1028
1029
1030 =item --log-file-format ARG
1031
1032 =item --log-file-format=ARG
1033
1034 =item --lff ARG
1035
1036 =item --lff=ARG
1037
1038 =item --no-log-file-format
1039
1040 Specify the format for automatically-generated log files. Overridden by --log-file, if given. This option implies -L (Default: \$YATH_LOG_FILE_FORMAT, if that is set, or else "%!P%Y-%m-%d~%H:%M:%S~%!U~%!p.jsonl"). This is a string in which percent-escape sequences will be replaced as per POSIX::strftime. The following special escape sequences are also replaced: (%!P : Project name followed by a ~, if a project is defined, otherwise empty string) (%!U : the unique test run ID) (%!p : the process ID) (%!S : the number of seconds since local midnight UTC)
1041
1042 Can also be set with the following environment variables: C<YATH_LOG_FILE_FORMAT>, C<TEST2_HARNESS_LOG_FORMAT>
1043
1044
1045 =back
1046
1047 =head3 Notification Options
1048
1049 =over 4
1050
1051 =item --notify-email [email protected]
1052
1053 =item --no-notify-email
1054
1055 Email the test results to the specified email address(es)
1056
1057 Can be specified multiple times
1058
1059
1060 =item --notify-email-fail [email protected]
1061
1062 =item --no-notify-email-fail
1063
1064 Email failing results to the specified email address(es)
1065
1066 Can be specified multiple times
1067
1068
1069 =item --notify-email-from [email protected]
1070
1071 =item --no-notify-email-from
1072
1073 If any email is sent, this is who it will be from
1074
1075
1076 =item --notify-email-owner
1077
1078 =item --no-notify-email-owner
1079
1080 Email the owner of broken tests files upon failure. Add `# HARNESS-META-OWNER [email protected]` to the top of a test file to give it an owner
1081
1082
1083 =item --notify-no-batch-email
1084
1085 =item --no-notify-no-batch-email
1086
1087 Usually owner failures are sent as a single batch at the end of testing. Toggle this to send failures as they happen.
1088
1089
1090 =item --notify-no-batch-slack
1091
1092 =item --no-notify-no-batch-slack
1093
1094 Usually owner failures are sent as a single batch at the end of testing. Toggle this to send failures as they happen.
1095
1096
1097 =item --notify-slack '#foo'
1098
1099 =item --notify-slack '@bar'
1100
1101 =item --no-notify-slack
1102
1103 Send results to a slack channel and/or user
1104
1105 Can be specified multiple times
1106
1107
1108 =item --notify-slack-fail '#foo'
1109
1110 =item --notify-slack-fail '@bar'
1111
1112 =item --no-notify-slack-fail
1113
1114 Send failing results to a slack channel and/or user
1115
1116 Can be specified multiple times
1117
1118
1119 =item --notify-slack-owner
1120
1121 =item --no-notify-slack-owner
1122
1123 Send slack notifications to the slack channels/users listed in test meta-data when tests fail.
1124
1125
1126 =item --notify-slack-url https://hooks.slack.com/...
1127
1128 =item --no-notify-slack-url
1129
1130 Specify an API endpoint for slack webhook integrations
1131
1132
1133 =item --notify-text ARG
1134
1135 =item --notify-text=ARG
1136
1137 =item --message ARG
1138
1139 =item --message=ARG
1140
1141 =item --msg ARG
1142
1143 =item --msg=ARG
1144
1145 =item --no-notify-text
1146
1147 Add a custom text snippet to email/slack notifications
1148
1149
1150 =item --notify-text-module ARG
1151
1152 =item --notify-text-module=ARG
1153
1154 =item --message_module ARG
1155
1156 =item --message_module=ARG
1157
1158 =item --no-notify-text-module
1159
1160 Use the specified module to generate messages for emails and/or slack.
1161
1162
1163 =back
1164
1165 =head3 Run Options
1166
1167 =over 4
1168
1169 =item --author-testing
1170
1171 =item -A
1172
1173 =item --no-author-testing
1174
1175 This will set the AUTHOR_TESTING environment to true
1176
1177
1178 =item --dbi-profiling
1179
1180 =item --no-dbi-profiling
1181
1182 Use Test2::Plugin::DBIProfile to collect database profiling data
1183
1184
1185 =item --env-var VAR=VAL
1186
1187 =item -EVAR=VAL
1188
1189 =item -E VAR=VAL
1190
1191 =item --no-env-var
1192
1193 Set environment variables to set when each test is run.
1194
1195 Can be specified multiple times
1196
1197
1198 =item --event-uuids
1199
1200 =item --uuids
1201
1202 =item --no-event-uuids
1203
1204 Use Test2::Plugin::UUID inside tests (default: on)
1205
1206
1207 =item --fields name:details
1208
1209 =item --fields JSON_STRING
1210
1211 =item -f name:details
1212
1213 =item -f JSON_STRING
1214
1215 =item --no-fields
1216
1217 Add custom data to the harness run
1218
1219 Can be specified multiple times
1220
1221
1222 =item --input ARG
1223
1224 =item --input=ARG
1225
1226 =item --no-input
1227
1228 Input string to be used as standard input for ALL tests. See also: --input-file
1229
1230
1231 =item --input-file ARG
1232
1233 =item --input-file=ARG
1234
1235 =item --no-input-file
1236
1237 Use the specified file as standard input to ALL tests
1238
1239
1240 =item --io-events
1241
1242 =item --no-io-events
1243
1244 Use Test2::Plugin::IOEvents inside tests to turn all prints into test2 events (default: off)
1245
1246
1247 =item --link 'https://travis.work/builds/42'
1248
1249 =item --link 'https://jenkins.work/job/42'
1250
1251 =item --link 'https://buildbot.work/builders/foo/builds/42'
1252
1253 =item --no-link
1254
1255 Provide one or more links people can follow to see more about this run.
1256
1257 Can be specified multiple times
1258
1259
1260 =item --load ARG
1261
1262 =item --load=ARG
1263
1264 =item --load-module ARG
1265
1266 =item --load-module=ARG
1267
1268 =item -m ARG
1269
1270 =item -m=ARG
1271
1272 =item --no-load
1273
1274 Load a module in each test (after fork). The "import" method is not called.
1275
1276 Can be specified multiple times
1277
1278
1279 =item --load-import Module
1280
1281 =item --load-import Module=import_arg1,arg2,...
1282
1283 =item --loadim Module
1284
1285 =item --loadim Module=import_arg1,arg2,...
1286
1287 =item -M Module
1288
1289 =item -M Module=import_arg1,arg2,...
1290
1291 =item --no-load-import
1292
1293 Load a module in each test (after fork). Import is called.
1294
1295 Can be specified multiple times. If the same key is listed multiple times the value lists will be appended together.
1296
1297
1298 =item --mem-usage
1299
1300 =item --no-mem-usage
1301
1302 Use Test2::Plugin::MemUsage inside tests (default: on)
1303
1304
1305 =item --retry ARG
1306
1307 =item --retry=ARG
1308
1309 =item -r ARG
1310
1311 =item -r=ARG
1312
1313 =item --no-retry
1314
1315 Run any jobs that failed a second time. NOTE: --retry=1 means failing tests will be attempted twice!
1316
1317
1318 =item --retry-isolated
1319
1320 =item --retry-iso
1321
1322 =item --no-retry-isolated
1323
1324 If true then any job retries will be done in isolation (as though -j1 was set)
1325
1326
1327 =item --run-id
1328
1329 =item --id
1330
1331 =item --no-run-id
1332
1333 Set a specific run-id. (Default: a UUID)
1334
1335
1336 =item --test-args ARG
1337
1338 =item --test-args=ARG
1339
1340 =item --no-test-args
1341
1342 Arguments to pass in as @ARGV for all tests that are run. These can be provided easier using the '::' argument separator.
1343
1344 Can be specified multiple times
1345
1346
1347 =item --stream
1348
1349 =item --no-stream
1350
1351 Use the stream formatter (default is on)
1352
1353
1354 =item --tap
1355
1356 =item --TAP
1357
1358 =item ----no-stream
1359
1360 =item --no-tap
1361
1362 The TAP format is lossy and clunky. Test2::Harness normally uses a newer streaming format to receive test results. There are old/legacy tests where this causes problems, in which case setting --TAP or --no-stream can help.
1363
1364
1365 =back
1366
1367 =head3 YathUI Options
1368
1369 =over 4
1370
1371 =item --yathui-api-key ARG
1372
1373 =item --yathui-api-key=ARG
1374
1375 =item --no-yathui-api-key
1376
1377 Yath-UI API key. This is not necessary if your Yath-UI instance is set to single-user
1378
1379
1380 =item --yathui-coverage
1381
1382 =item --no-yathui-coverage
1383
1384 Poll coverage data from Yath-UI to determine what tests should be run for changed files
1385
1386
1387 =item --yathui-durations
1388
1389 =item --no-yathui-durations
1390
1391 Poll duration data from Yath-UI to help order tests efficiently
1392
1393
1394 =item --yathui-grace
1395
1396 =item --no-yathui-grace
1397
1398 If yath cannot connect to yath-ui it normally throws an error, use this to make it fail gracefully. You get a warning, but things keep going.
1399
1400
1401 =item --yathui-long-duration 10
1402
1403 =item --no-yathui-long-duration
1404
1405 Minimum duration length (seconds) before a test goes from MEDIUM to LONG
1406
1407
1408 =item --yathui-medium-duration 5
1409
1410 =item --no-yathui-medium-duration
1411
1412 Minimum duration length (seconds) before a test goes from SHORT to MEDIUM
1413
1414
1415 =item --yathui-mode summary
1416
1417 =item --yathui-mode qvf
1418
1419 =item --yathui-mode qvfd
1420
1421 =item --yathui-mode complete
1422
1423 =item --no-yathui-mode
1424
1425 Set the upload mode (default 'qvfd')
1426
1427
1428 =item --yathui-project ARG
1429
1430 =item --yathui-project=ARG
1431
1432 =item --no-yathui-project
1433
1434 The Yath-UI project for your test results
1435
1436
1437 =item --yathui-retry
1438
1439 =item --no-yathui-retry
1440
1441 How many times to try an operation before giving up
1442
1443 Can be specified multiple times
1444
1445
1446 =item --yathui-upload
1447
1448 =item --no-yathui-upload
1449
1450 Upload the log to Yath-UI
1451
1452
1453 =item --yathui-url http://my-yath-ui.com/...
1454
1455 =item --uri http://my-yath-ui.com/...
1456
1457 =item --no-yathui-url
1458
1459 Yath-UI url
1460
1461
1462 =back
1463
1464 =head3 NO CATEGORY - FIX ME
1465
1466 =over 4
1467
1468 =item --check-reload-state
1469
1470 =item --no-check-reload-state
1471
1472 Abort the run if there are unfixes reload errors and show a confirmation dialogue for unfixed reload warnings.
1473
1474
1475 =back
1476
1477 =head1 SOURCE
1478
1479 The source code repository for Test2-Harness can be found at
1480 F<http://github.com/Test-More/Test2-Harness/>.
1481
1482 =head1 MAINTAINERS
1483
1484 =over 4
1485
1486 =item Chad Granum E<lt>[email protected]<gt>
1487
1488 =back
1489
1490 =head1 AUTHORS
1491
1492 =over 4
1493
1494 =item Chad Granum E<lt>[email protected]<gt>
1495
1496 =back
1497
1498 =head1 COPYRIGHT
1499
1500 Copyright 2026 Chad Granum E<lt>[email protected]<gt>.
1501
1502 This program is free software; you can redistribute it and/or
1503 modify it under the same terms as Perl itself.
1504
1505 See F<http://dev.perl.org/licenses/>
1506
1507 =cut
1508