lib: redefine the overall timeout logic of test
PATCH v3 1/1 lib: redefine the overall timeout logic of test
This patch revises the logic for managing test timeout and runtime limits, introducing a more structured approach. The key changes include renaming max_runtime to runtime for clarity and adding overall_time to represent the total time limit for a test. This ensures better separation of test phases (setup, execution, and cleanup) and clearer timeout management.
Key Concepts:
timeout: Defines the maximum time allowed for the entire test, including
setup, execution, and cleanup, when no explicit runtime is set. But if a runtime is explicitly defined and tst_remaining_runtime() is used, the timeout applies only to the setup and cleanup phases, as the runtime controls the test execution duration.
runtime: The maximum runtime of the test's main execution loop, used
in tests that call tst_remaining_runtime(). It ensures the main execution runs for a fixed duration, regardless of kernel configuration (e.g., debug kernel).
Overall timeout is structured as follows:
| -- (default_30s + timeout) * timeout_mul -- | -- runtime * runtime_mul -- |
And, the TST_UNLIMITED_RUNTIME constant has been deprecated and replaced by TST_UNLIMITED_TIMEOUT. This change simplifies the handling of unlimited execution scenarios while aligning the terminology with the new timeout model.
---
Notes:
Changes V2 --> V3:
* Improve timeout description based on Cyril's suggestion
* Move .runtime to .timeout for some tests (fsplough, ksm02, ksm04)
* Drop the changes on shell test test_timeout.sh
* Squash tst_set_timeout and set_mempolicy01 patches into the first one
* Double the duration of a single test iteration on an RPi4 and use that value to set .timeout for readahead02 test
CI job: https://github.com/wangli5665/ltp/actions/runs/12690072719/
doc/old/C-Test-API.asciidoc | 50 +++++--- doc/users/setup_tests.rst | 6 +- include/tst_test.h | 39 +++++-- lib/newlib_tests/test_runtime01.c | 2 +- lib/newlib_tests/test_runtime02.c | 2 +- lib/newlib_tests/tst_fuzzy_sync01.c | 2 +- lib/newlib_tests/tst_fuzzy_sync02.c | 2 +- lib/newlib_tests/tst_fuzzy_sync03.c | 2 +- lib/tst_test.c | 108 ++++++++++-------- lib/tst_timer_test.c | 2 +- testcases/cve/cve-2014-0196.c | 2 +- testcases/cve/cve-2015-3290.c | 2 +- testcases/cve/cve-2016-7117.c | 2 +- testcases/cve/cve-2017-2671.c | 2 +- .../kernel/controllers/cgroup/cgroup_core03.c | 2 +- testcases/kernel/crypto/af_alg02.c | 2 +- testcases/kernel/crypto/af_alg07.c | 2 +- testcases/kernel/crypto/pcrypt_aead01.c | 2 +- testcases/kernel/fs/fs_fill/fs_fill.c | 2 +- testcases/kernel/fs/fsplough/fsplough.c | 2 +- testcases/kernel/fs/fsx-linux/fsx-linux.c | 2 +- testcases/kernel/fs/read_all/read_all.c | 4 +- testcases/kernel/io/ltp-aiodio/aio-stress.c | 2 +- testcases/kernel/io/ltp-aiodio/aiocp.c | 2 +- .../kernel/io/ltp-aiodio/aiodio_append.c | 2 +- .../kernel/io/ltp-aiodio/aiodio_sparse.c | 2 +- testcases/kernel/io/ltp-aiodio/dio_append.c | 2 +- testcases/kernel/io/ltp-aiodio/dio_read.c | 2 +- testcases/kernel/io/ltp-aiodio/dio_sparse.c | 2 +- testcases/kernel/io/ltp-aiodio/dio_truncate.c | 2 +- testcases/kernel/mem/ksm/ksm02.c | 4 +- testcases/kernel/mem/ksm/ksm04.c | 4 +- .../kernel/mem/mmapstress/mmapstress01.c | 2 +- testcases/kernel/mem/mtest01/mtest01.c | 2 +- testcases/kernel/mem/mtest06/mmap1.c | 2 +- testcases/kernel/mem/mtest06/mmap3.c | 2 +- testcases/kernel/mem/mtest07/mallocstress.c | 2 +- testcases/kernel/mem/oom/oom01.c | 2 +- testcases/kernel/mem/oom/oom02.c | 2 +- testcases/kernel/mem/oom/oom03.c | 2 +- testcases/kernel/mem/oom/oom04.c | 2 +- testcases/kernel/mem/oom/oom05.c | 2 +- testcases/kernel/mem/swapping/swapping01.c | 2 +- testcases/kernel/mem/thp/thp04.c | 2 +- .../kernel/mem/tunable/min_free_kbytes.c | 2 +- testcases/kernel/pty/pty03.c | 2 +- testcases/kernel/pty/pty05.c | 2 +- testcases/kernel/pty/pty06.c | 2 +- testcases/kernel/pty/pty07.c | 2 +- .../sched/cfs-scheduler/cfs_bandwidth01.c | 2 +- .../kernel/sched/cfs-scheduler/starvation.c | 2 +- .../security/dirtyc0w_shmem/dirtyc0w_shmem.c | 2 +- testcases/kernel/security/kallsyms/kallsyms.c | 2 +- testcases/kernel/sound/snd_seq01.c | 2 +- testcases/kernel/sound/snd_timer01.c | 2 +- testcases/kernel/syscalls/bind/bind06.c | 2 +- .../copy_file_range/copy_file_range01.c | 2 +- .../kernel/syscalls/fallocate/fallocate06.c | 2 +- testcases/kernel/syscalls/fork/fork13.c | 2 +- testcases/kernel/syscalls/fsync/fsync02.c | 2 +- .../syscalls/gettimeofday/gettimeofday02.c | 2 +- testcases/kernel/syscalls/inotify/inotify06.c | 2 +- testcases/kernel/syscalls/inotify/inotify09.c | 2 +- testcases/kernel/syscalls/inotify/inotify12.c | 2 +- testcases/kernel/syscalls/ioctl/ioctl_sg01.c | 2 +- .../syscalls/ipc/msgstress/msgstress01.c | 2 +- .../kernel/syscalls/ipc/semget/semget05.c | 2 +- .../kernel/syscalls/ipc/shmctl/shmctl05.c | 2 +- testcases/kernel/syscalls/keyctl/keyctl02.c | 2 +- .../kernel/syscalls/landlock/landlock04.c | 2 +- testcases/kernel/syscalls/madvise/madvise06.c | 2 +- testcases/kernel/syscalls/madvise/madvise11.c | 2 +- .../syscalls/migrate_pages/migrate_pages03.c | 2 +- .../kernel/syscalls/move_pages/move_pages12.c | 2 +- testcases/kernel/syscalls/nice/nice05.c | 2 +- .../perf_event_open/perf_event_open02.c | 2 +- .../perf_event_open/perf_event_open03.c | 2 +- testcases/kernel/syscalls/preadv2/preadv203.c | 2 +- .../kernel/syscalls/readahead/readahead02.c | 17 +-- .../syscalls/request_key/request_key03.c | 2 +- .../kernel/syscalls/sendfile/sendfile09.c | 2 +- testcases/kernel/syscalls/sendmsg/sendmsg03.c | 2 +- .../syscalls/set_mempolicy/set_mempolicy01.c | 6 +- .../kernel/syscalls/setsockopt/setsockopt06.c | 2 +- .../kernel/syscalls/setsockopt/setsockopt07.c | 2 +- testcases/kernel/syscalls/swapoff/swapoff01.c | 2 +- testcases/kernel/syscalls/swapon/swapon01.c | 2 +- .../syscalls/timerfd/timerfd_settime02.c | 2 +- testcases/kernel/syscalls/writev/writev03.c | 2 +- testcases/network/can/cve/can_bcm01.c | 2 +- testcases/network/netstress/netstress.c | 2 +- .../network/nfs/nfs_stress/nfs05_make_tree.c | 2 +- testcases/network/packet/fanout01.c | 2 +- testcases/network/sockets/vsock01.c | 2 +- 94 files changed, 222 insertions(+), 186 deletions(-)
doc/old/C-Test-API.asciidoc +34 -16
@@ -94,26 +94,32 @@ in range of [0, '.tcnt' - 1]. IMPORTANT: Only one of '.test' and '.test_all' can be set at a time. -Each test has a limit on how long it can run and the limit composes of two -parts max_runtime and timeout. The max_runtime is a limit for how long can the -'.test_all' or a set of '.test' functions take and the timeout is static part -that should cover the duration of test setup and cleanup plus some safety. +Each test has a limit on how long it can run, composed of two parts: 'runtime' +and 'timeout'. The 'runtime' is the limit for how long the '.test_all' or a set +of '.test' main functions can execute. The 'timeout', on the other hand, applies +to the total time for setup, single test function invocation, cleanup, and some +additional safety margin. If test without an explicit runtime, the 'timeout' +governs the entire test duration. + +The timeout timer is also reset on each subsequent iteration with the test -i +parameter, variants or .all_filesystems. Any test that runs for more than a second or two has to make sure to: -- set the runtime either by setting the '.max_runtime' in tst_test or by - calling 'tst_set_max_runtime()' in the test setup +- set the runtime by setting '.runtime' in tst_test and calling 'tst_set_runtime()' + to monitor the remaining runtime and ensure the test exits when the runtime + limit is reached. -- monitor remaning runtime by regular calls to 'tst_remaining_runtime()' and - exit when runtime has been used up +- set the timeout by setting '.timeout' in tst_test to limit the whole test + run that does not use 'tst_remaining_runtime()'. -Test is free to exit before max_runtime has been used up for example when +Test is free to exit before runtime has been used up for example when minimal number of iteration was finished. The limit is applied to a single call of the '.test_all' function that means that for example when '.test_variants' or '.all_filesystems' is set the whole -test will be limited by 'variants * (max_runtime + timeout)' seconds and the -test runtime will be likely close to 'variants * max_runtime' seconds. +test will be limited by 'variants * (runtime + timeout)' seconds and the +test runtime will be likely close to 'variants * runtime' seconds. [source,c] -------------------------------------------------------------------------------
@@ -401,13 +407,25 @@ WARNING: This function is not thread safe. [source,c] ------------------------------------------------------------------------------- -void tst_set_max_runtime(int max_runtime); +void tst_set_timeout(int timeout); ------------------------------------------------------------------------------- -Allows for setting max_runtime per test iteration dynamically in the test 'setup()', -the timeout is specified in seconds. There are a few testcases whose runtime -can vary arbitrarily, these can disable timeouts by setting it to -TST_UNLIMITED_RUNTIME. +Allows for setting the entire timeout dynamically during the test setup(). The +timeout is specified in seconds and represents the total time allowed for a single +test iteration, including setup, runtime, and teardown phases. + +[source,c] +------------------------------------------------------------------------------- +void tst_set_runtime(int runtime); +------------------------------------------------------------------------------- + +Allows for setting the runtime per test iteration dynamically during the test 'setup()'. +The runtime is specified in seconds and represents the duration the test is allowed +to execute its main workload, excluding setup and teardown phases. + +This function is useful for tests where the duration of the main workload can be +controlled or needs to be adjusted dynamically. For example, tests that loop until +the runtime expires can use this function to define how long they should run. [source,c] -------------------------------------------------------------------------------
doc/users/setup_tests.rst +3 -3
@@ -87,14 +87,14 @@ See :master:`testcases/network/README.md`. Test execution time and timeout ------------------------------- -The limit on how long a test can run does compose of two parts: ``max_runtime`` +The limit on how long a test can run does compose of two parts: ``runtime`` and ``timeout``. The limit does apply to a single test variant. That means, for example, that tests which run for all available filesystems will apply this limit for a single filesystem only. -The ``max_runtime`` is a cap on how long the ``run()`` function can take and for +The ``runtime`` is a cap on how long the ``run()`` function can take and for most testcases this part is set to zero. For tests that do run for more than a -second or two the ``max_runtime`` has to be defined and the ``run()`` function +second or two the ``runtime`` has to be defined and the ``run()`` function has to check actively how much runtime is left. Test runtime can be scaled up and down with ``LTP_RUNTIME_MUL`` environment
include/tst_test.h +29 -10
@@ -234,7 +234,7 @@ struct tst_tag {extern unsigned int tst_variant; -#define TST_UNLIMITED_RUNTIME (-1) +#define TST_UNLIMITED_TIMEOUT (-1)/** * struct tst_ulimit_val - An ulimit resource and value.
@@ -435,13 +435,26 @@ struct tst_fs {* The directory is created by the library, the test must not create * it itself. * -* @max_runtime: Maximal test runtime in seconds. Any test that runs for more -* than a second or two should set this and also use -* tst_remaining_runtime() to exit when runtime was used up. -* Tests may finish sooner, for example if requested number of -* iterations was reached before the runtime runs out. If test -* runtime cannot be know in advance it should be set to -* TST_UNLIMITED_RUNTIME. +* @timeout: Maximum allowable time in seconds for the entire duration of a test. +* By default, the timeout limits the total time for setup, single test +* function invocation, and cleanup phases. However, if .runtime is +* explicitly set and tst_remaining_runtime() is used in the test's +* main loop, the timeout then applies only to the setup and cleanup +* phases, as the runtime separately limits the main test execution. +* This ensures the test does not hang indefinitely, in the rare case +* that the test timeout cannot be accurately determined, it can be +* set to a sufficientlylarge value or TST_UNLIMITED_TIMEOUT to remove +* the limit. +* +* @runtime: Maximum runtime in seconds for the test's main execution loop. +* This should be set for tests that are expected to run longer +* than a few seconds and call tst_remaining_runtime() in their +* main loop to exit gracefully when the runtime is exceeded. +* Tests may finish sooner if their task completes (e.g., reaching +* a requested number of iterations) before the runtime runs out. +* The runtime is fixed and does not scale with timeout multipliers +* (e.g., TIMEOUT_MUL), ensuring consistent test duration across +* different environments (e.g., debug vs. stock kernels). * * @setup: Setup callback is called once at the start of the test in order to * prepare the test environment.
@@ -565,7 +578,8 @@ struct tst_fs {const char *mntpoint; -int max_runtime; +int timeout; +int runtime;void (*setup)(void );void (*cleanup)(void );
@@ -662,6 +676,11 @@ void tst_reinit(void);*/ int tst_run_script (const char *script_name,char *const params[]); +/* +* Sets entire timeout in seconds. +*/ +void tst_set_timeout (int timeout); +unsigned int tst_multiply_timeout (unsigned int timeout);/*
@@ -676,7 +695,7 @@ unsigned int tst_remaining_runtime(void);/* * Sets maximal test runtime in seconds. */ -void tst_set_max_runtime (int max_runtime); +void tst_set_runtime (int runtime);/* * Create and open a random file inside the given dir path.
lib/newlib_tests/test_runtime01.c +1 -1
@@ -25,6 +25,6 @@ static void run(void)static struct tst_test test = { .test_all = run, - .max_runtime =4 , + .runtime =4 , .test_variants =2 , };
lib/newlib_tests/test_runtime02.c +1 -1
@@ -24,5 +24,5 @@ static void run(void)static struct tst_test test = { .test_all = run, - .max_runtime =5 , + .runtime =5 , };
lib/newlib_tests/tst_fuzzy_sync01.c +1 -1
@@ -248,5 +248,5 @@ static struct tst_test test = { .test = run, .setup = setup, .cleanup = cleanup, - .max_runtime = 150, + .runtime = 150, };
lib/newlib_tests/tst_fuzzy_sync02.c +1 -1
@@ -225,5 +225,5 @@ static struct tst_test test = { .test = run, .setup = setup, .cleanup = cleanup, - .max_runtime = 150, + .runtime = 150, };
lib/newlib_tests/tst_fuzzy_sync03.c +1 -1
@@ -99,5 +99,5 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .test_all = run, - .max_runtime = 150, + .runtime = 150, };
lib/tst_test.c +60 -48
197 lines not on this page · raw message
lib/tst_timer_test.c +1 -1
@@ -454,7 +454,7 @@ static void parse_timer_opts(void) runtime_us += tcases[i].usec * tcases[i].samples; } -tst_set_max_runtime ((runtime_us + runtime_us/10 )/1000000 ); +tst_set_runtime ((runtime_us + runtime_us/10 )/1000000 ); }struct tst_test *tst_timer_test_setup (struct tst_test *timer_test)
testcases/cve/cve-2014-0196.c +1 -1
@@ -141,7 +141,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .test_all = run, - .max_runtime = 60, + .runtime = 60, .tags = (const struct tst_tag []) { {"linux-git" ,"4291086b1f08" }, {"CVE" ,"2014-0196" },
testcases/cve/cve-2015-3290.c +1 -1
@@ -519,7 +519,7 @@ static struct tst_test test = { .needs_root = 1, .needs_checkpoints = 1, .setup = setup, - .max_runtime = 180, + .runtime = 180, .test_all = run, .tags = (const struct tst_tag []) { {"linux-git" ,"9b6e6a8334d5" },
testcases/cve/cve-2016-7117.c +1 -1
@@ -149,7 +149,7 @@ static struct tst_test test = { .test_all = run, .setup = setup, .cleanup = cleanup, - .max_runtime = 60, + .runtime = 60, .tags = (const struct tst_tag []) { {"linux-git" ,"a2e2725541fa" }, {"CVE" ,"2016-7117" },
testcases/cve/cve-2017-2671.c +1 -1
@@ -109,7 +109,7 @@ static struct tst_test test = { .test_all = run, .cleanup = cleanup, .needs_root = 1, - .max_runtime = 40, + .runtime = 40, .tags = (const struct tst_tag []) { {"linux-git" ,"43a6684519ab" }, {"CVE" ,"2017-2671" },
testcases/kernel/controllers/cgroup/cgroup_core03.c +1 -1
@@ -124,7 +124,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .forks_child = 1, - .max_runtime = 20, + .timeout = 20, .needs_cgroup_ctrls = (const char *const []){ "base", NULL }, .needs_cgroup_ver = TST_CG_V2, .needs_checkpoints = 1,
testcases/kernel/crypto/af_alg02.c +1 -1
@@ -77,7 +77,7 @@ static void run(void)static struct tst_test test = { .test_all = run, - .max_runtime =20 , + .runtime =20 , .needs_checkpoints =1 , .tags = (const struct tst_tag []) { {"linux-git" ,"ecaaab564978" },
testcases/kernel/crypto/af_alg07.c +1 -1
@@ -125,7 +125,7 @@ static struct tst_test test = { .cleanup = cleanup, .min_kver = "4.10.0", .min_cpus = 2, - .max_runtime = 150, + .runtime = 150, .taint_check = TST_TAINT_W | TST_TAINT_D, .tags = (const struct tst_tag []) { {"linux-git" ,"ff7b11aa481f" },
testcases/kernel/crypto/pcrypt_aead01.c +1 -1
@@ -75,7 +75,7 @@ static struct tst_test test = { .test_all = run, .cleanup = cleanup, .needs_root = 1, - .max_runtime = 300, + .runtime = 300, .tags = (const struct tst_tag []) { {"linux-git" ,"d76c68109f37" }, {"CVE" ,"2017-18075" },
testcases/kernel/fs/fs_fill/fs_fill.c +1 -1
@@ -121,7 +121,7 @@ static void cleanup(void) }static struct tst_test test = { - .max_runtime =300 , + .timeout =300 , .needs_root =1 , .dev_min_size =1024 , .mount_device =1 ,
testcases/kernel/fs/fsplough/fsplough.c +1 -1
@@ -190,7 +190,7 @@ static void setup(void) MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); filedata =SAFE_MALLOC (filesize); -tst_set_max_runtime (bufsize * loop_count / (8 *1024 *1024 )); +tst_set_timeout (bufsize * loop_count / (8 *1024 *1024 )); }static void run (void )
testcases/kernel/fs/fsx-linux/fsx-linux.c +1 -1
@@ -367,7 +367,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .test_all = run, - .max_runtime = 1800, + .timeout = 1800, .options = (struct tst_option []) { {"l:" , &str_file_max_size,"Maximum size in MB of the test file(s) (default 262144)" }, {"o:" , &str_op_max_size,"Maximum size for single operation (default 65536)" },
testcases/kernel/fs/read_all/read_all.c +2 -2
@@ -598,7 +598,7 @@ static void setup(void) worker_timeout); }else { worker_timeout =10 *tst_remaining_runtime (); -tst_res (TINFO ,"Worker timeout set to 10%% of max_runtime: %dms" , +tst_res (TINFO ,"Worker timeout set to 10%% of runtime: %dms" , worker_timeout); } worker_timeout *=1000 ;
@@ -746,5 +746,5 @@ static struct tst_test test = { .cleanup = cleanup, .test_all = run, .forks_child = 1, - .max_runtime = 100, + .runtime = 100, };
testcases/kernel/io/ltp-aiodio/aio-stress.c +1 -1
@@ -1347,7 +1347,7 @@ static struct tst_test test = { .setup = setup, .needs_tmpdir = 1, .needs_root = 1, - .max_runtime = 1800, + .timeout = 1800, .options = (struct tst_option []){ {"a:" , &str_iterations,"Total number of ayncs I/O the program will run (default 500)" }, {"b:" , &str_max_io_submit,"Max number of iocbs to give io_submit at once" },
testcases/kernel/io/ltp-aiodio/aiocp.c +1 -1
@@ -322,7 +322,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .needs_tmpdir = 1, - .max_runtime = 1800, + .runtime = 1800, .needs_root = 1, .options = (struct tst_option []) { {"b:" , &str_aio_blksize,"Size of writing blocks (default 1K)" },
testcases/kernel/io/ltp-aiodio/aiodio_append.c +1 -1
@@ -190,7 +190,7 @@ static struct tst_test test = { .cleanup = cleanup, .needs_tmpdir = 1, .forks_child = 1, - .max_runtime = 1800, + .runtime = 1800, .options = (struct tst_option []) { {"n:" , &str_numchildren,"Number of threads (default 16)" }, {"s:" , &str_writesize,"Size of the file to write (default 64K)" },
testcases/kernel/io/ltp-aiodio/aiodio_sparse.c +1 -1
@@ -244,7 +244,7 @@ static struct tst_test test = {"tmpfs" ,NULL }, - .max_runtime = 1800, + .runtime = 1800, };#else TST_TEST_TCONF ("test requires libaio and its development packages" );
testcases/kernel/io/ltp-aiodio/dio_append.c +1 -1
@@ -96,7 +96,7 @@ static struct tst_test test = { .cleanup = cleanup, .needs_tmpdir = 1, .forks_child = 1, - .max_runtime = 1800, + .runtime = 1800, .options = (struct tst_option []) { {"n:" , &str_numchildren,"Number of processes (default 16)" }, {"w:" , &str_writesize,"Write size for each append (default 64K)" },
testcases/kernel/io/ltp-aiodio/dio_read.c +1 -1
@@ -178,7 +178,7 @@ static struct tst_test test = { .cleanup = cleanup, .needs_tmpdir = 1, .forks_child = 1, - .max_runtime = 1800, + .runtime = 1800, .options = (struct tst_option []) { {"n:" , &str_numchildren,"Number of threads (default 8)" }, {"w:" , &str_writesize,"Size of writing blocks (default 32M)" },
testcases/kernel/io/ltp-aiodio/dio_sparse.c +1 -1
@@ -135,5 +135,5 @@ static struct tst_test test = { "tmpfs",NULL }, - .max_runtime = 1800, + .runtime = 1800, };
testcases/kernel/io/ltp-aiodio/dio_truncate.c +1 -1
@@ -170,7 +170,7 @@ static struct tst_test test = { .cleanup = cleanup, .needs_tmpdir = 1, .forks_child = 1, - .max_runtime = 1800, + .runtime = 1800, .options = (struct tst_option []) { {"n:" , &str_numchildren,"Number of threads (default 16)" }, {"s:" , &str_filesize,"Size of file (default 64K)" },
testcases/kernel/mem/ksm/ksm02.c +2 -2
@@ -87,7 +87,7 @@ static void setup(void)parse_ksm_options (opt_sizestr, &size, opt_numstr, &num, opt_unitstr, &unit);if (opt_sizestr && size >DEFAULT_MEMSIZE ) -tst_set_max_runtime (32 * (size /DEFAULT_MEMSIZE )); +tst_set_timeout (32 * (size /DEFAULT_MEMSIZE )); }static struct tst_test test = {
@@ -116,7 +116,7 @@ static struct tst_test test = {NULL }, .test_all = verify_ksm, - .max_runtime = 32, + .timeout = 32, .needs_cgroup_ctrls = (const char *const []){ "cpuset", NULL }, };
testcases/kernel/mem/ksm/ksm04.c +2 -2
@@ -74,7 +74,7 @@ static void setup(void)SAFE_CG_PRINTF (tst_cg,"cgroup.procs" ,"%d" ,getpid ());if (opt_sizestr && size >DEFAULT_MEMSIZE ) -tst_set_max_runtime (32 * (size /DEFAULT_MEMSIZE )); +tst_set_timeout (32 * (size /DEFAULT_MEMSIZE )); }static struct tst_test test = {
@@ -103,7 +103,7 @@ static struct tst_test test = {NULL }, .test_all = verify_ksm, - .max_runtime = 32, + .timeout = 32, .needs_cgroup_ctrls = (const char *const []){"memory" ,"cpuset" ,NULL },
testcases/kernel/mem/mmapstress/mmapstress01.c +1 -1
@@ -362,7 +362,7 @@ static struct tst_test test = { {}, }, .cleanup = cleanup, - .max_runtime = 12, + .runtime = 12, .needs_tmpdir = 1, .forks_child = 1, };
testcases/kernel/mem/mtest01/mtest01.c +1 -1
@@ -235,7 +235,7 @@ static struct tst_test test = { {"v", &verbose, "Verbose"}, {} }, - .max_runtime = 300, + .runtime = 300, .setup = setup, .cleanup = cleanup, .test_all = mem_test,
testcases/kernel/mem/mtest06/mmap1.c +1 -1
@@ -249,6 +249,6 @@ static void run(void)static struct tst_test test = { .test_all = run, .setup = setup, - .max_runtime =180 , + .runtime =180 , .needs_tmpdir =1 , };
testcases/kernel/mem/mtest06/mmap3.c +1 -1
@@ -182,5 +182,5 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .test_all = test_mmap, - .max_runtime = 60, + .runtime = 60, };
testcases/kernel/mem/mtest07/mallocstress.c +1 -1
@@ -194,7 +194,7 @@ static void cleanup(void) }static struct tst_test test = { - .max_runtime =600 , + .runtime =600 , .needs_checkpoints =1 , .setup = setup, .cleanup = cleanup,
testcases/kernel/mem/oom/oom01.c +1 -1
@@ -36,7 +36,7 @@ static void verify_oom(void)static struct tst_test test = { .needs_root =1 , .forks_child =1 , - .max_runtime =TST_UNLIMITED_RUNTIME , + .timeout =TST_UNLIMITED_TIMEOUT , .test_all = verify_oom, .skip_in_compat =1 , .save_restore = (const struct tst_path_val []) {
testcases/kernel/mem/oom/oom02.c +1 -1
@@ -45,7 +45,7 @@ static void setup(void)static struct tst_test test = { .needs_root =1 , .forks_child =1 , - .max_runtime =TST_UNLIMITED_RUNTIME , + .timeout =TST_UNLIMITED_TIMEOUT , .setup = setup, .test_all = verify_oom, .skip_in_compat =1 ,
testcases/kernel/mem/oom/oom03.c +1 -1
@@ -71,7 +71,7 @@ static void setup(void)static struct tst_test test = { .needs_root =1 , .forks_child =1 , - .max_runtime =TST_UNLIMITED_RUNTIME , + .timeout =TST_UNLIMITED_TIMEOUT , .setup = setup, .test_all = verify_oom, .needs_cgroup_ctrls = (const char *const []){"memory" ,NULL },
testcases/kernel/mem/oom/oom04.c +1 -1
@@ -67,7 +67,7 @@ static void setup(void)static struct tst_test test = { .needs_root =1 , .forks_child =1 , - .max_runtime =TST_UNLIMITED_RUNTIME , + .timeout =TST_UNLIMITED_TIMEOUT , .setup = setup, .test_all = verify_oom, .needs_cgroup_ctrls = (const char *const []){"cpuset" ,NULL },
testcases/kernel/mem/oom/oom05.c +1 -1
@@ -88,7 +88,7 @@ void setup(void)static struct tst_test test = { .needs_root =1 , .forks_child =1 , - .max_runtime =TST_UNLIMITED_RUNTIME , + .timeout =TST_UNLIMITED_TIMEOUT , .setup = setup, .test_all = verify_oom, .needs_cgroup_ctrls = (const char *const []){
testcases/kernel/mem/swapping/swapping01.c +1 -1
@@ -174,7 +174,7 @@ static struct tst_test test = { .needs_root = 1, .forks_child = 1, .min_mem_avail = 10, - .max_runtime = 600, + .runtime = 600, .test_all = test_swapping, .skip_in_compat = 1, .needs_kconfigs = (const char *[]) {
testcases/kernel/mem/thp/thp04.c +1 -1
@@ -161,7 +161,7 @@ static struct tst_test test = { .test_all = run, .setup = setup, .cleanup = cleanup, - .max_runtime = 150, + .runtime = 150, .tags = (const struct tst_tag []) { {"linux-git" ,"a8f97366452e" }, {"linux-git" ,"8310d48b125d" },
testcases/kernel/mem/tunable/min_free_kbytes.c +1 -1
@@ -221,7 +221,7 @@ static void setup(void)static struct tst_test test = { .needs_root =1 , .forks_child =1 , - .max_runtime =TST_UNLIMITED_RUNTIME , + .timeout =TST_UNLIMITED_TIMEOUT , .setup = setup, .test_all = min_free_kbytes_test, .save_restore = (const struct tst_path_val []) {
testcases/kernel/pty/pty03.c +1 -1
@@ -152,7 +152,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .needs_root = 1, - .max_runtime = 30, + .runtime = 30, .needs_kconfigs = (const char *const []){"CONFIG_SERIO_SERPORT" ,NULL
testcases/kernel/pty/pty05.c +1 -1
@@ -97,7 +97,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .taint_check = TST_TAINT_W | TST_TAINT_D, - .max_runtime = 150, + .runtime = 150, .tags = (const struct tst_tag []) { {"linux-git" ,"82f2341c94d27" }, {"CVE" ,"2017-2636" },
testcases/kernel/pty/pty06.c +1 -1
@@ -97,7 +97,7 @@ static struct tst_test test = { .cleanup = cleanup, .needs_root = 1, .taint_check = TST_TAINT_W | TST_TAINT_D, - .max_runtime = 150, + .runtime = 150, .tags = (const struct tst_tag []) { {"CVE" ,"2020-36557" }, {"linux-git" ,"ca4463bf8438" },
testcases/kernel/pty/pty07.c +1 -1
@@ -114,7 +114,7 @@ static struct tst_test test = { .cleanup = cleanup, .needs_root = 1, .taint_check = TST_TAINT_W | TST_TAINT_D, - .max_runtime = 150, + .runtime = 150, .tags = (const struct tst_tag []) { {"linux-git" ,"6cd1ed50efd8" }, {}
testcases/kernel/sched/cfs-scheduler/cfs_bandwidth01.c +1 -1
@@ -174,7 +174,7 @@ static struct tst_test test = { .cleanup = cleanup, .forks_child = 1, .needs_checkpoints = 1, - .max_runtime = 20, + .timeout = 20, .taint_check = TST_TAINT_W | TST_TAINT_D, .needs_kconfigs = (const char *[]) {"CONFIG_CFS_BANDWIDTH" ,
testcases/kernel/sched/cfs-scheduler/starvation.c +1 -1
@@ -112,7 +112,7 @@ static void setup(void)if (tst_has_slow_kconfig ())tst_brk (TCONF ,"Skip test due to slow kernel configuration" ); -tst_set_max_runtime (timeout); +tst_set_runtime (timeout); } static void handler(int sig LTP_ATTRIBUTE_UNUSED)
testcases/kernel/security/dirtyc0w_shmem/dirtyc0w_shmem.c +1 -1
@@ -108,7 +108,7 @@ static struct tst_test test = { .needs_checkpoints = 1, .forks_child = 1, .needs_root = 1, - .max_runtime = 120, + .runtime = 120, .setup = setup, .cleanup = cleanup, .test_all = dirtyc0w_shmem_test,
testcases/kernel/security/kallsyms/kallsyms.c +1 -1
@@ -203,7 +203,7 @@ static struct tst_test test = { .needs_root = 1, .setup = setup, .cleanup = cleanup, - .max_runtime = 60, + .timeout = 60, .needs_kconfigs = (const char *const []){"CONFIG_KALLSYMS=y" ,NULL
testcases/kernel/sound/snd_seq01.c +1 -1
@@ -123,7 +123,7 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(testfunc_list), .setup = setup, .cleanup = cleanup, - .max_runtime = 60, + .runtime = 60, .taint_check = TST_TAINT_W | TST_TAINT_D, .tags = (const struct tst_tag []) { {"linux-git" ,"d15d662e89fc" },
testcases/kernel/sound/snd_timer01.c +1 -1
@@ -136,7 +136,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .taint_check = TST_TAINT_W | TST_TAINT_D, - .max_runtime = 150, + .runtime = 150, .tags = (const struct tst_tag []) { {"linux-git" ,"d11662f4f798" }, {"linux-git" ,"ba3021b2c79b" },
testcases/kernel/syscalls/bind/bind06.c +1 -1
@@ -92,7 +92,7 @@ static struct tst_test test = { .test_all = run, .setup = setup, .cleanup = cleanup, - .max_runtime = 300, + .runtime = 300, .taint_check = TST_TAINT_W | TST_TAINT_D, .needs_kconfigs = (const char *[]) {"CONFIG_USER_NS=y" ,
testcases/kernel/syscalls/copy_file_range/copy_file_range01.c +1 -1
@@ -232,5 +232,5 @@ static struct tst_test test = { .all_filesystems = 1, .test = copy_file_range_verify, .test_variants = TEST_VARIANTS, - .max_runtime = 5 + .timeout = 5 };
testcases/kernel/syscalls/fallocate/fallocate06.c +1 -1
@@ -261,7 +261,7 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(testcase_list), .needs_root = 1, .dev_min_size = 1024, - .max_runtime = 120, + .timeout = 120, .mount_device = 1, .mntpoint = MNTPOINT, .all_filesystems = 1,
testcases/kernel/syscalls/fork/fork13.c +1 -1
@@ -110,7 +110,7 @@ static void check(void)static struct tst_test test = { .needs_root =1 , .forks_child =1 , - .max_runtime =600 , + .runtime =600 , .test_all = check, .save_restore = (const struct tst_path_val []) { {"/proc/sys/kernel/pid_max" ,PID_MAX_STR ,TST_SR_TBROK },
testcases/kernel/syscalls/fsync/fsync02.c +1 -1
@@ -115,5 +115,5 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .needs_tmpdir = 1, - .max_runtime = 300, + .timeout = 300, };
testcases/kernel/syscalls/gettimeofday/gettimeofday02.c +1 -1
@@ -72,6 +72,6 @@ static void setup(void)static struct tst_test test = { .setup = setup, - .max_runtime =10 , + .runtime =10 , .test_all = verify_gettimeofday, };
testcases/kernel/syscalls/inotify/inotify06.c +1 -1
@@ -116,7 +116,7 @@ static void cleanup(void) }static struct tst_test test = { - .max_runtime =600 , + .runtime =600 , .needs_root =1 , .needs_tmpdir =1 , .forks_child =1 ,
testcases/kernel/syscalls/inotify/inotify09.c +1 -1
@@ -97,7 +97,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .test_all = verify_inotify, - .max_runtime = 150, + .runtime = 150, .tags = (const struct tst_tag []) { {"linux-git" ,"d90a10e2444b" }, {}
testcases/kernel/syscalls/inotify/inotify12.c +1 -1
@@ -153,7 +153,7 @@ static void cleanup(void) }static struct tst_test test = { - .max_runtime =10 , + .timeout =10 , .needs_tmpdir =1 , .cleanup = cleanup, .test = verify_inotify,
testcases/kernel/syscalls/ioctl/ioctl_sg01.c +1 -1
@@ -128,7 +128,7 @@ static struct tst_test test = { .test_all = run, .setup = setup, .cleanup = cleanup, - .max_runtime = 3600, + .timeout = 3600, .tags = (const struct tst_tag []) { {"linux-git" ,"a45b599ad808" }, {"CVE" ,"2018-1000204" },
testcases/kernel/syscalls/ipc/msgstress/msgstress01.c +1 -1
@@ -311,7 +311,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .forks_child = 1, - .max_runtime = 180, + .runtime = 180, .options = (struct tst_option []) { {"n:" , &str_num_messages,"Number of messages to send (default: 1000)" }, {"l:" , &str_num_iterations,"Number iterations per message (default: "
testcases/kernel/syscalls/ipc/semget/semget05.c +1 -1
@@ -43,7 +43,7 @@ static void setup(void)SAFE_FILE_SCANF ("/proc/sys/kernel/sem" ,"%*d %*d %*d %d" , &maxsems);/* Prevent timeout due to high semaphore array limit */ -tst_set_max_runtime (maxsems /200 ); +tst_set_runtime (maxsems /200 ); sem_id_arr =SAFE_MALLOC ((maxsems - used_cnt) *sizeof (int ));for (num =0 ; num < maxsems - used_cnt; num++) {
testcases/kernel/syscalls/ipc/shmctl/shmctl05.c +1 -1
@@ -106,7 +106,7 @@ static void cleanup(void) }static struct tst_test test = { - .max_runtime =10 , + .runtime =10 , .setup = setup, .test_all = do_test, .cleanup = cleanup,
testcases/kernel/syscalls/keyctl/keyctl02.c +1 -1
@@ -160,7 +160,7 @@ static struct tst_test test = { .needs_root = 1, .setup = setup, .cleanup = cleanup, - .max_runtime = 60, + .runtime = 60, .test_all = do_test, .tags = (const struct tst_tag []) { {"linux-git" ,"b4a1b4f5047e" },
testcases/kernel/syscalls/landlock/landlock04.c +1 -1
@@ -204,5 +204,5 @@ static struct tst_test test = { .mount_device = 1, .mntpoint = SANDBOX_FOLDER, .all_filesystems = 1, - .max_runtime = 360, + .timeout = 360, };
testcases/kernel/syscalls/madvise/madvise06.c +1 -1
@@ -242,7 +242,7 @@ static struct tst_test test = { .setup = setup, .needs_tmpdir = 1, .needs_root = 1, - .max_runtime = 60, + .timeout = 60, .taint_check = TST_TAINT_W | TST_TAINT_D, .save_restore = (const struct tst_path_val []) { {"/proc/sys/vm/swappiness" ,NULL ,
testcases/kernel/syscalls/madvise/madvise11.c +1 -1
@@ -432,7 +432,7 @@ static struct tst_test test = {"CONFIG_MEMORY_FAILURE=y" ,NULL }, - .max_runtime = 30, + .runtime = 30, .needs_checkpoints = 1, .setup = setup, .cleanup = cleanup,
testcases/kernel/syscalls/migrate_pages/migrate_pages03.c +1 -1
@@ -139,7 +139,7 @@ static void migrate_test(void) }static struct tst_test test = { - .max_runtime =300 , + .runtime =300 , .needs_root =1 , .setup = setup, .cleanup = cleanup,
testcases/kernel/syscalls/move_pages/move_pages12.c +1 -1
@@ -342,7 +342,7 @@ static struct tst_test test = { .cleanup = cleanup, .test = do_test, .tcnt = ARRAY_SIZE(tcases), - .max_runtime = 240, + .runtime = 240, .tags = (const struct tst_tag []) { {"linux-git" ,"e66f17ff7177" }, {"linux-git" ,"c9d398fa2378" },
testcases/kernel/syscalls/nice/nice05.c +1 -1
@@ -154,5 +154,5 @@ static struct tst_test test = { .setup = setup, .test_all = verify_nice, .needs_root = 1, - .max_runtime = 3, + .runtime = 3, };
testcases/kernel/syscalls/perf_event_open/perf_event_open02.c +1 -1
@@ -334,5 +334,5 @@ static struct tst_test test = { }, .test_all = verify, .needs_root = 1, - .max_runtime = 72 + .timeout = 72 };
testcases/kernel/syscalls/perf_event_open/perf_event_open03.c +1 -1
@@ -127,7 +127,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .needs_root = 1, - .max_runtime = 300, + .runtime = 300, .tags = (const struct tst_tag []) { {"linux-git" ,"7bdb157cdebb" }, {"CVE" ,"2020-25704" },
testcases/kernel/syscalls/preadv2/preadv203.c +1 -1
@@ -278,6 +278,6 @@ static struct tst_test test = { .mntpoint = MNTPOINT, .mount_device = 1, .all_filesystems = 1, - .max_runtime = 60, + .runtime = 60, .needs_root = 1, };
testcases/kernel/syscalls/readahead/readahead02.c +2 -15
@@ -318,19 +318,6 @@ static void test_readahead(unsigned int n)tst_res (TCONF ,"Page cache on your system is too small " "to hold whole testfile." ); } - -/* -* The time consuming of readahead quite depending on the platform IO -* speed, sometime test timeout when the default max_runtime is used up. -* -* readahead02.c:221: TINFO: Test #2: POSIX_FADV_WILLNEED on file -* readahead02.c:285: TINFO: read_testfile(0) took: 26317623 usec -* readahead02.c:286: TINFO: read_testfile(1) took: 26101484 usec -* -* Here raise the maximum runtime dynamically. -*/ -if ((tc+1 )->readahead) -tst_set_max_runtime (test.max_runtime + (usec + usec_ra) /1000000 ); }
@@ -381,7 +368,7 @@ static void setup(void) {if (opt_fsizestr) { testfile_size =SAFE_STRTOL (opt_fsizestr,1 ,INT_MAX ); -tst_set_max_runtime (1 + testfile_size / (DEFAULT_FILESIZE /32 )); +tst_set_runtime (1 + testfile_size / (DEFAULT_FILESIZE /32 )); }if (access (PROC_IO_FNAME ,F_OK ))
@@ -422,7 +409,7 @@ static struct tst_test test = { }, .test = test_readahead, .tcnt = ARRAY_SIZE(tcases), - .max_runtime = 30, + .runtime = 60, .tags = (const struct tst_tag []) { {"linux-git" ,"b833a3660394" }, {"linux-git" ,"5b910bd615ba" },
testcases/kernel/syscalls/request_key/request_key03.c +1 -1
@@ -215,7 +215,7 @@ static struct tst_test test = { .test = do_test, .tcnt = ARRAY_SIZE(testcase_list), .forks_child = 1, - .max_runtime = 20, + .runtime = 20, .options = (struct tst_option []) { {"b:" , &opt_bug,"Bug to test for (cve-2017-15299 or cve-2017-15951; default is both)" }, {}
testcases/kernel/syscalls/sendfile/sendfile09.c +1 -1
@@ -93,7 +93,7 @@ static struct tst_test test = { .setup = setup, .test = run, .tcnt = ARRAY_SIZE(tc), - .max_runtime = 120, + .timeout = 120, .skip_in_compat = 1, .tags = (const struct tst_tag []) { {"linux-git" ,"5d73320a96fcc" },
testcases/kernel/syscalls/sendmsg/sendmsg03.c +1 -1
@@ -105,7 +105,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .taint_check = TST_TAINT_W | TST_TAINT_D, - .max_runtime = 150, + .runtime = 150, .needs_kconfigs = (const char *[]) {"CONFIG_USER_NS=y" ,"CONFIG_NET_NS=y" ,
testcases/kernel/syscalls/set_mempolicy/set_mempolicy01.c +3 -3
@@ -41,9 +41,9 @@ static void setup(void)* has multiple NUMA nodes, the test matrix combination grows exponentially * and bring about test time to increase extremely fast. * -* Here reset the maximum runtime according to the NUMA nodes. +* Here reset the entire timeout according to the NUMA nodes. */ -tst_set_max_runtime (test.max_runtime * (1 << nodes->cnt/16 )); +tst_set_timeout (test.timeout * (1 << nodes->cnt/16 )); }static void cleanup (void )
@@ -119,7 +119,7 @@ static struct tst_test test = { .tcnt = 2, .forks_child = 1, .needs_checkpoints = 1, - .max_runtime = 600, + .timeout = 600, };#else
testcases/kernel/syscalls/setsockopt/setsockopt06.c +1 -1
@@ -110,7 +110,7 @@ static struct tst_test test = { .test_all = run, .setup = setup, .cleanup = cleanup, - .max_runtime = 270, + .runtime = 270, .taint_check = TST_TAINT_W | TST_TAINT_D, .needs_kconfigs = (const char *[]) {"CONFIG_USER_NS=y" ,
testcases/kernel/syscalls/setsockopt/setsockopt07.c +1 -1
@@ -123,7 +123,7 @@ static struct tst_test test = { .test_all = run, .setup = setup, .cleanup = cleanup, - .max_runtime = 150, + .runtime = 150, .needs_kconfigs = (const char *[]) {"CONFIG_USER_NS=y" ,"CONFIG_NET_NS=y" ,
testcases/kernel/syscalls/swapoff/swapoff01.c +1 -1
@@ -53,6 +53,6 @@ static struct tst_test test = { .all_filesystems = 1, .needs_root = 1, .test_all = verify_swapoff, - .max_runtime = 60, + .timeout = 60, .setup = setup };
testcases/kernel/syscalls/swapon/swapon01.c +1 -1
@@ -51,6 +51,6 @@ static struct tst_test test = { .all_filesystems = 1, .needs_cgroup_ctrls = (const char *const []){ "memory", NULL }, .test_all = verify_swapon, - .max_runtime = 60, + .timeout = 60, .setup = setup };
testcases/kernel/syscalls/timerfd/timerfd_settime02.c +1 -1
@@ -111,7 +111,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .taint_check = TST_TAINT_W | TST_TAINT_D, - .max_runtime = 150, + .runtime = 150, .tags = (const struct tst_tag []) { {"linux-git" ,"1e38da300e1e" }, {"CVE" ,"2017-10661" },
testcases/kernel/syscalls/writev/writev03.c +1 -1
@@ -145,7 +145,7 @@ static struct tst_test test = { .min_cpus = 2, .setup = setup, .cleanup = cleanup, - .max_runtime = 75, + .runtime = 75, .tags = (const struct tst_tag []) { {"linux-git" ,"d4690f1e1cda" }, {}
testcases/network/can/cve/can_bcm01.c +1 -1
@@ -141,7 +141,7 @@ static struct tst_test test = { .taint_check = TST_TAINT_W | TST_TAINT_D, .needs_root = 1, .skip_in_compat = 1, - .max_runtime = 30, + .runtime = 30, .needs_drivers = (const char *const []) {"vcan" ,"can-bcm" ,
testcases/network/netstress/netstress.c +1 -1
@@ -1024,6 +1024,6 @@ static struct tst_test test = { {"B:", &server_bg, "Run in background, arg is the process directory"}, {} }, - .max_runtime = 300, + .timeout = 300, .needs_checkpoints = 1, };
testcases/network/nfs/nfs_stress/nfs05_make_tree.c +1 -1
@@ -214,5 +214,5 @@ static struct tst_test test = { .options = opts, .test_all = do_test, .setup = setup, - .max_runtime = 300, + .timeout = 300, };
testcases/network/packet/fanout01.c +1 -1
@@ -89,7 +89,7 @@ static struct tst_test test = { .test_all = run, .cleanup = cleanup, .needs_root = 1, - .max_runtime = 180, + .runtime = 180, .needs_kconfigs = (const char *[]) {"CONFIG_USER_NS=y" ,"CONFIG_NET_NS=y" ,
testcases/network/sockets/vsock01.c +1 -1
@@ -112,7 +112,7 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .taint_check = TST_TAINT_W | TST_TAINT_D, - .max_runtime = 60, + .runtime = 60, .needs_kconfigs = (const char *[]) {"CONFIG_VSOCKETS_LOOPBACK" ,NULL
Signature · 5 lines
2.47.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
To patch reviewer:
Looks like this patch fell behind the last one commit f162bff0af19ce7d7f3, please drop that one manually if you want to apply it without conflicts locally.
I will do code rebase once getting enough Reviewed-by tags.
Li Wang
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel
Reviewed-byHi Li, Cyril,
We have some warnings due this change:
- int max_runtime;
+ unsigned int runtime;
tst_test.c: In function ‘tst_remaining_runtime’:
tst_test.c:1691:30: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
1691 | if (results->runtime > elapsed)
| ^tst_test.c: In function ‘set_overall_timeout’:
tst_test.c:1720:30: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]
1720 | if (results->runtime < 0) {
| ^
I suppose we don't need this check any more:
if (results->runtime < 0) {
tst_brk(TBROK, "runtime must to be > 0! (%d)",
results->runtime);
}because TST_UNLIMITED_TIMEOUT is now tested against tst_test->timeout.
Could you please fix it before merge?
Quoted 10 lines
Quoted 10 lines
timeout: Defines the maximum time allowed for the entire test, including
setup, execution, and cleanup, when no explicit runtime is set. But if a runtime is explicitly defined andtst_remaining_runtime()is used, the timeout applies only to the setup and cleanup phases, as the runtime controls the test execution duration.runtime: The maximum runtime of the test's main execution loop, used
in tests that calltst_remaining_runtime(). It ensures the main execution runs for a fixed duration, regardless of kernel configuration (e.g., debug kernel).
If I look correctly atm we have none tests with both .timeout and .runtime.
IMHO only tests with tst_remaining_runtime() or fuzzy sync should use .runtime.
When I check:
$ git grep -l -e tst_remaining_runtime -e tst_fuzzy_sync.h $(git log --oneline --pretty="format:" --name-only -1) |wc -l 60
$ git grep '\.runtime' $(git log --oneline --pretty="format:" --name-only -1) |wc -l 60
testcases/kernel/syscalls/readahead/readahead02.c uses .runtime but (as Cyril noted) you wanted to add it .timeout (I also think it should use .timeout).
But testcases/kernel/sched/cfs-scheduler/starvation.c calls tst_remaining_runtime() but it's without .runtime. Don't we want to set it?
Also it got TCONF previously, I might try to put it back after this is merged.
Or better for whole tree:
$ git grep -l -e tst_remaining_runtime -e tst_fuzzy_sync.h testcases/ |wc -l 54
$ git grep -l '\.runtime' testcases/ |wc -l 53
The difference is with testcases/kernel/io/ltp-aiodio/common.h and all tests which use it use .runtime.
=> everything looks ok.
Quoted 3 lines
Quoted 3 lines
Overall timeout is structured as follows:
| -- (
default_30s+ timeout) *timeout_mul-- | -- runtime *runtime_mul-- |
I like the diagram :). Later maybe it could be added to tst_remaining_runtime(), which does not use sphinx doc but it's used by many tests. Also, overall timeout would deserve moving from doc/old/C-Test-API.asciidoc to some specific page in sphinx (maybe part of lib/README.md conversion).
Quoted 1 line
+ * set to a sufficientlylarge value or
TST_UNLIMITED_TIMEOUTto remove
missing space:
* set to a sufficiently large value or TST_UNLIMITED_TIMEOUT to remove
Could you please fix it before merge?
Quoted 1 line
Quoted 1 line
* Move .runtime to .timeout for some tests (fsplough, ksm02, ksm04)
FYI fsplough uses tst_set_timeout() only.
Quoted 1 line
Quoted 1 line
* Drop the changes on shell test
test_timeout.sh
I wonder what to do with shell timeout in the future. Not needed to be changed?
Quoted 5 lines
lib/tst_test.c unsigned int tst_multiply_timeout(unsigned int timeout) · line 1716
Quoted 3 lines
lib/tst_test.c +1
-1-if (results->max_runtime ==TST_UNLIMITED_RUNTIME ) { +if (tst_test->timeout ==TST_UNLIMITED_TIMEOUT ) {tst_res (TINFO ,"Timeout per run is disabled" );+additional safety margin. If test without an explicit runtime, the 'timeout'
nit: I would format also 'runtime'
+additional safety margin. If test without an explicit 'runtime', the 'timeout'
Maybe we could unify also this commit message to:
if (tst_test->timeout == TST_UNLIMITED_TIMEOUT) {
tst_res(TINFO, "Test timeout is not limited");
return;
}Quoted 7 lines
To patch reviewer:
Looks like this patch fell behind the last one commit
f162bff0af19ce7d7f3, please drop that one manually if you want to apply it without conflicts locally.I will do code rebase once getting enough Reviewed-by tags.
I'm sorry for merging f162bff0af19ce7d7f3. I suppose rebase master should be ok.
For me worked without the need to resolve the conflict:
git checkout f162bff0af19ce7d7f3~
git am YOUR_PATCH.mbox
git rebase master
Kind regards,
Petr
Quoted 1 line
Li Wang
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Li, Cyril,
I also did some tests on cve and syscalls. So far looks good, testing also net.nfs + aiodio.
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 5 lines · Petr Vorel
Hi Li, Cyril,
I also did some tests on cve and syscalls. So far looks good, testing also net.nfs + aiodio.
Thanks, patch merged with your both suggestions.
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 5 lines
Quoted 3 lines
I also did some tests on cve and syscalls. So far looks good, testing also net.nfs + aiodio.
Thanks, patch merged with your both suggestions.
Thanks for fixing this!
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 58 lines · Petr Vorel
Hi Li, Cyril,
We have some warnings due this change:
lib/tst_test.c +1
-1-int max_runtime; +unsigned int runtime;
tst_test.c: In function ‘tst_remaining_runtime’:
tst_test.c:1691:30: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]
1691 | if (results->runtime> elapsed)
| ^tst_test.c: In function ‘set_overall_timeout’:
tst_test.c:1720:30: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]
1720 | if (results->runtime< 0) {
| ^I suppose we don't need this check any more:
if (results->runtime < 0) { tst_brk(TBROK, "runtime must to be > 0! (%d)", results->runtime); }because
TST_UNLIMITED_TIMEOUTis now tested againsttst_test->timeout.Could you please fix it before merge?
Quoted 1 line
Quoted 1 line
timeout: Defines the maximum time allowed for the entire test,
including
Quoted 1 line
Quoted 1 line
setup, execution, and cleanup, when no explicit runtime is
set.
Quoted 1 line
Quoted 1 line
But if a runtime is explicitly defined and
tst_remaining_runtime()Quoted 1 line
Quoted 1 line
is used, the timeout applies only to the setup and cleanup
phases,
Quoted 6 lines
Quoted 6 lines
as the runtime controls the test execution duration.
runtime: The maximum runtime of the test's main execution loop, used
in tests that calltst_remaining_runtime(). It ensures the
main execution runs for a fixed duration, regardless of kernel configuration (e.g., debug kernel).If I look correctly atm we have none tests with both .timeout and .runtime.
IMHO only tests with
tst_remaining_runtime()or fuzzy sync should use .runtime.When I check:
$ git grep -l -e tst_remaining_runtime -e tst_fuzzy_sync.h $(git log --oneline --pretty="format:" --name-only -1) |wc -l 60$ git grep '\.runtime' $(git log --oneline --pretty="format:" --name-only -1) |wc -l 60
Quoted 7 lines
testcases/kernel/syscalls/readahead/readahead02.cuses .runtime but (as Cyril
noted) you wanted to add it .timeout (I also think it should use .timeout).But
testcases/kernel/sched/cfs-scheduler/starvation.ccallstst_remaining_runtime()but it's without .runtime. Don't we want to set it?
No, the .runtime is being set by tst_set_runtime in the setup, that is based on the CPU calibrate and kernel configs measurement.
So, it's unnecessary to set a value in the tst_test->runtime again, it will be reset in the setup anyway.
The reset comments all sound good to me. Thanks!
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 5 lines · Petr Vorel
Quoted 1 line
Quoted 1 line
* Drop the changes on shell test
test_timeout.shI wonder what to do with shell timeout in the future. Not needed to be changed?
We'd better redesign the shell timeout tests according to the new timeout logic.
Later I will look into them.
Signature · 5 lines
Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
* Drop the changes on shell test
test_timeout.shI wonder what to do with shell timeout in the future. Not needed to be changed?
We'd better redesign the shell timeout tests according to the new timeout logic.
Later I will look into them.
I will add a proper support for runtime and timeout to the tst_run_shell.c after the release.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 7 lines
Hi!
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
* Drop the changes on shell test
test_timeout.shI wonder what to do with shell timeout in the future. Not needed to be changed?
Quoted 6 lines
Quoted 3 lines
We'd better redesign the shell timeout tests according to the new timeout logic.
Later I will look into them.I will add a proper support for runtime and timeout to the
tst_run_shell.cafter the release.
Thanks to both to handle this!
Kind regards,
Petr
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Quoted 8 lines
Notes:
Changes V2 --> V3:
* Improve timeout description based on Cyril's suggestion
* Move .runtime to .timeout for some tests (fsplough, ksm02, ksm04)
* Drop the changes on shell testtest_timeout.sh
* Squashtst_set_timeoutandset_mempolicy01patches into the first one
* Double the duration of a single test iteration on an RPi4 and use that value to set .timeout for readahead02 test
Here you say timeout
Quoted 34 lines
testcases/kernel/syscalls/readahead/readahead02.c +1
-14@@ -318,19 +318,6 @@ static void test_readahead(unsigned int n)tst_res (TCONF ,"Page cache on your system is too small " "to hold whole testfile." ); } - -/* -* The time consuming of readahead quite depending on the platform IO -* speed, sometime test timeout when the default max_runtime is used up. -* -* readahead02.c:221: TINFO: Test #2: POSIX_FADV_WILLNEED on file -* readahead02.c:285: TINFO: read_testfile(0) took: 26317623 usec -* readahead02.c:286: TINFO: read_testfile(1) took: 26101484 usec -* -* Here raise the maximum runtime dynamically. -*/ -if ((tc+1 )->readahead) -tst_set_max_runtime (test.max_runtime + (usec + usec_ra) /1000000 ); }@@ -381,7 +368,7 @@ static void setup(void) {if (opt_fsizestr) { testfile_size =SAFE_STRTOL (opt_fsizestr,1 ,INT_MAX ); -tst_set_max_runtime (1 + testfile_size / (DEFAULT_FILESIZE /32 )); +tst_set_runtime (1 + testfile_size / (DEFAULT_FILESIZE /32 )); }if (access (PROC_IO_FNAME ,F_OK ))
testcases/kernel/syscalls/readahead/readahead02.c static struct tst_test test = { · line 412
Quoted 5 lines
testcases/kernel/syscalls/readahead/readahead02.c +1
-1@@ -422,7 +409,7 @@ static struct tst_test test = { }, .test = test_readahead, .tcnt = ARRAY_SIZE(tcases), - .max_runtime = 30, + .runtime = 60,
But you actually set runtime instead.
testcases/kernel/syscalls/readahead/readahead02.c static struct tst_test test = { · line 415
Quoted 3 lines
testcases/kernel/syscalls/readahead/readahead02.c +0
-0.tags = (const struct tst_tag[]) { {"linux-git" ,"b833a3660394" }, {"linux-git" ,"5b910bd615ba" },
Otherwise:
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp