#!/usr/bin/env perl # Copyright (C) 2017 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 use 5.010; use strict; use warnings; package QtQA::App::TestRunner; =head1 NAME testrunner - helper script to safely run autotests =head1 SYNOPSIS # Run one autotest safely... $ path/to/testrunner [options] -- some/tst_test1 # Run many autotests safely... (from within a Qt project) # A maximum runtime of 2 minutes each... $ make check "TESTRUNNER=path/to/testrunner --timeout 120 --" # Will run: # path/to/testrunner --timeout 120 -- some/tst_test1 # path/to/testrunner --timeout 120 -- some/tst_test2 # etc... # Run many autotests and capture the logs to $HOME/test-logs, while also # displaying the logs as they are written $ make check "TESTRUNNER=path/to/testrunner --tee-logs $HOME/test-logs --timeout 120 --" # Will generate: # # $HOME/test-logs/testcase1-00.txt # $HOME/test-logs/testcase2-00.txt # This script is a wrapper for running autotests safely and ensuring that uniform results are generated. It is designed to integrate with Qt's `make check' feature. Some features of this script depend on QTestLib-style autotests, while others are usable for any kind of autotest. =head1 OPTIONS =over =item B<--help> Print this message. =item B<--> Separates the options to testrunner from the test command and arguments (mandatory). =item B<--timeout> If the test takes longer than seconds, it will be killed, and the testrunner will exit with a non-zero exit code to indicate failure. =item B<-C> =item B<--chdir> Change to the specified directory before running the test. =item B<--label>