New runner to rule them all, version 2
Subsystems (2)
PATCH v2 1/5 lib: Print subtest starting/ending line to stderr too
In reply to Petri Latvalawhen instructed via the environment. This is needed for the new test runner to properly assign stderr output to the correct subtest.
v2:
Print the subtest result from skip_subtests_henceforth handling also to stderr.
--- lib/igt_core.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
lib/igt_core.c +16 -1
@@ -305,6 +305,8 @@ GKeyFile *igt_key_file;char *igt_frame_dump_path; +static bool stderr_needs_sentinel = false; +const char *igt_test_name (void ) {return command_str;
@@ -649,6 +651,8 @@ static void common_init_env(void) } igt_frame_dump_path =getenv ("IGT_FRAME_DUMP_PATH" ); + + stderr_needs_sentinel =getenv ("IGT_SENTINEL_ON_STDERR" ) !=NULL ; } static int common_init(int *argc, char **argv,
@@ -927,12 +931,20 @@ bool __igt_run_subtest(const char *subtest_name) (!__igt_plain_output) ?"\x1b[1m" :"" , subtest_name, skip_subtests_henceforth ==SKIP ? "SKIP" : "FAIL", (!__igt_plain_output) ? "\x1b[0m" : ""); +fflush (stdout); +if (stderr_needs_sentinel) +fprintf (stderr,"Subtest %s: %s\n" , subtest_name, + skip_subtests_henceforth ==SKIP ? +"SKIP" :"FAIL" );return false; }igt_kmsg (KMSG_INFO "%s: starting subtest %s\n" , command_str, subtest_name); -igt_debug ("Starting subtest: %s\n" , subtest_name); +igt_info ("Starting subtest: %s\n" , subtest_name); +fflush (stdout); +if (stderr_needs_sentinel) +fprintf (stderr,"Starting subtest: %s\n" , subtest_name);_igt_log_buffer_reset ();
@@ -987,6 +999,9 @@ static void exit_subtest(const char *result) in_subtest, result,time_elapsed (&subtest_time, &now), (!__igt_plain_output) ? "\x1b[0m" : "");fflush (stdout); +if (stderr_needs_sentinel) +fprintf (stderr,"Subtest %s: %s (%.3fs)\n" , + in_subtest, result,time_elapsed (&subtest_time, &now));igt_terminate_spin_batches ();
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v2 3/5 uwildmat: Case-insensitive test selection
In reply to Petri LatvalaSince we only use plain ascii in subtest names, using non-locale-aware tolower() to compare case-insensitively works.
Doing this within uwildmat instead of tolowering the subtest name and then calling uwildmat() is required, because of selection strings like:
foo,bar,!Foo
The above line will select subtest Bar, and not select Foo.
--- lib/uwildmat/uwildmat.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
lib/uwildmat/uwildmat.c +8 -3
@@ -93,6 +93,7 @@** accompanying test suite achieves 100% coverage of this file. */ +#include <ctype.h> #include <string.h> #include <stdint.h> #include "uwildmat/uwildmat.h"
@@ -222,6 +223,7 @@ match_class(uint32_t text, const unsigned char *start,const unsigned char *p = start;uint32_t first =0 ;uint32_t last; +uint32_t lc =tolower (text);/* Check for an inverted character class (starting with ^). If the character matches the character class, we return !reversed; that way,
@@ -244,12 +246,13 @@ match_class(uint32_t text, const unsigned char *start,if (allowrange && *p =='-' && p < end) { p++; p +=utf8_decode (p, end, &last); -if (text >= first && text <= last) +if ((text >= first && text <= last) || + (lc >= first && lc <= last))return !reversed; allowrange = false; }else { p +=utf8_decode (p, end, &first); -if (text == first) +if (text == first || lc == first)return !reversed; allowrange = true; }
@@ -272,6 +275,7 @@ match_pattern(const unsigned char *text, const unsigned char *start,bool ismeta;int matched, width;uint32_t c; +unsigned char lc;for (; p <= end; p++) {if (!*text && *p !='*' )
@@ -284,7 +288,8 @@ match_pattern(const unsigned char *text, const unsigned char *start,/* Fall through. */ default : -if (*text++ != *p) + lc =tolower (*text); +if (*text++ != *p && lc != *p)return false;break ;
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v2 4/5 runner: New test runner
In reply to Petri LatvalaThis is a new test runner to replace piglit. Piglit has been very useful as a test runner, but certain improvements have been very difficult if possible at all in a generic test running framework.
Important improvements over piglit:
- Faster to launch. Being able to make assumptions about what we're executing makes it possible to save significant amounts of time. For example, a testlist file's line "igt@somebinary@somesubtest" already has all the information we need to construct the correct command line to execute that particular subtest, instead of listing all subtests of all test binaries and mapping them to command lines. Same goes for the regexp filters command line flags -t and -x; If we use -x somebinaryname, we don't need to list subtests from somebinaryname, we already know none of them will get executed.
- Logs of incomplete tests. Piglit collects test output to memory and dumps them to a file when the test is complete. The new runner writes all output to disk immediately.
- Ability to execute multiple subtests in one binary execution. This was possible with piglit, but its semantics made it very hard to implement in practice. For example, having a testlist file not only selected a subset of tests to run, but also mandated that they be executed in the same order.
- Flexible timeout support. Instead of mandating a time tests cannot exceed, the new runner has a timeout on inactivity. Activity is any output on the test's stdout or stderr, or kernel activity via /dev/kmsg.
The runner is fairly piglit compatible. The command line is very similar, with a few additions. IGT_TEST_ROOT environment flag is still supported, but can also be set via command line (in place of igt.py in piglit command line).
The results are a set of log files, processed into a piglit-compatible results.json file (BZ2 compression TODO). There are some new fields in the json for extra information:
- "igt-version" contains the IGT version line. In multiple-subtests-mode the version information is only printed once, so it needs to be duplicated to all subtest results this way.
- "dmesg-warnings" contains the dmesg lines that triggered a dmesg-warn/dmesg-fail state.
- Runtime information will be different. Piglit takes a timestamp at the beginning and at the end of execution for runtime. The new runner uses the subtest output text. The binary execution time will also be included; The key "igt@somebinary" will have the runtime of the binary "somebinary", whereas "igt@somebinary@a" etc will have the runtime of the subtests. Substracting the subtest runtimes from the binary runtime yields the total time spent doing setup in igt_fixture blocks.
v2:
- use clock handling from igt_core instead of copypaste
- install results binary
- less magic numbers
- scanf doesn't give empty strings after all
- use designated array initialization with _F_JOURNAL and pals
- add more comments to dump_dmesg
- use signal in kill_child instead of bool
- use more 'usual' return values for execute_entry
- use signal number instead of magic integers
- use IGT_EXIT_INVALID instead of magic 79
- properly remove files in clear_test_result_directory()
- remove magic numbers
- warn if results directory contains extra files
- fix naming in matches_any
- construct command line in a cleaner way in add_subtests()
- clarify error in filtered_job_list
- replace single string fprintfs with fputs
- use getline() more sanely
- refactor string constants to a shared header
- explain non-nul-terminated string handling in resultgen
- saner line parsing
- rename gen_igt_name to generate_piglit_name
- clean up parse_result_string
- explain what we're parsing in resultgen
- explain the runtime accumulation in add_runtime
- refactor result overriding
- stop passing needle sizes to find_line functions
- refactor stdout/stderr parsing
- fix regex whitelist compiling
- add TODO for suppressions.txt
- refactor dmesg parsing
- fill_from_journal returns void
- explain missing result fields with TODO comments
- log_level parsing with typeof
- pass stdout/stderr to usage() instead of a bool
- fix absolute_path overflow
- refactor settings serialization
- remove maybe_strdup function
- refactor job list serialization
- refactor resuming, add new resume binary
- catch mmap failure correctly
--- meson.build | 1 + runner/executor.c | 1022 +++++++++++++++++++++++++++++++++++++++++++++++ runner/executor.h | 49 +++ runner/job_list.c | 487 ++++++++++++++++++++++ runner/job_list.h | 37 ++ runner/meson.build | 33 ++ runner/output_strings.h | 38 ++ runner/resultgen.c | 954 +++++++++++++++++++++++++++++++++++++++++++ runner/resultgen.h | 9 + runner/results.c | 26 ++ runner/resume.c | 47 +++ runner/runner.c | 40 ++ runner/settings.c | 502 +++++++++++++++++++++++ runner/settings.h | 111 +++++ 14 files changed, 3356 insertions(+) create mode 100644 runner/executor.c create mode 100644 runner/executor.h create mode 100644 runner/job_list.c create mode 100644 runner/job_list.h create mode 100644 runner/meson.build create mode 100644 runner/output_strings.h create mode 100644 runner/resultgen.c create mode 100644 runner/resultgen.h create mode 100644 runner/results.c create mode 100644 runner/resume.c create mode 100644 runner/runner.c create mode 100644 runner/settings.c create mode 100644 runner/settings.h
meson.build +1 -0
@@ -136,6 +136,7 @@ subdir('lib') subdir('tests') subdir('benchmarks') subdir('tools') +subdir('runner') if libdrm_intel.found() subdir('assembler') if ['x86', 'x86_64'].contains(host_machine.cpu_family())
runner/executor.c new file +1022 -0
1,022 lines not on this page · raw message
runner/executor.h new file +49 -0
49 lines not on this page · raw message
runner/job_list.c new file +487 -0
487 lines not on this page · raw message
runner/job_list.h new file +37 -0
@@ -0,0 +1,37 @@ +#ifndef RUNNER_JOB_LIST_H +#define RUNNER_JOB_LIST_H + +#include <stdbool.h> + +#include "settings.h" + +struct job_list_entry { +char *binary; +char **subtests; +/* +* 0 = all, or test has no subtests. +* +* If the original job_list was to run all subtests of a +* binary and such a run was incomplete, resuming from the +* execution journal will fill the subtest array with already +* started subtests prepended with '!' so the test binary will +* not run them. subtest_count will still reflect the size of +* the above array. +*/ +size_t subtest_count; +}; + +struct job_list +{ +struct job_list_entry *entries; +size_t size; +}; + +void init_job_list (struct job_list *job_list); +void free_job_list (struct job_list *job_list); +bool create_job_list (struct job_list *job_list,struct settings *settings); + +bool serialize_job_list (struct job_list *job_list,struct settings *settings); +bool read_job_list (struct job_list *job_list,int dirfd); + +#endif
runner/meson.build new file +33 -0
@@ -0,0 +1,33 @@ +jsonc = dependency('json-c', required: true) + +runnerlib_sources = [ 'settings.c', + 'job_list.c', + 'executor.c', + 'resultgen.c', + ] + +runner_sources = [ 'runner.c' ] +resume_sources = [ 'resume.c' ] +results_sources = [ 'results.c' ] + +runnerlib = static_library('igt_runner', runnerlib_sources, + include_directories : inc, + dependencies : jsonc) + +runner = executable('runner', runner_sources, + link_with : runnerlib, + install : true, + install_dir : bindir, + dependencies : igt_deps) + +resume = executable('resume', resume_sources, + link_with : runnerlib, + install : true, + install_dir : bindir, + dependencies : igt_deps) + +results = executable('results', results_sources, + link_with : runnerlib, + install : true, + install_dir : bindir, + dependencies : igt_deps)
runner/output_strings.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef RUNNER_OUTPUT_STRINGS_H +#define RUNNER_OUTPUT_STRINGS_H + +/* +* Output when a subtest has begun. Is followed by the subtest name. +* +* Example: +* Starting subtest: subtestname +*/ +static const char starting_subtest[] ="Starting subtest: " ; + +/* +* Output when a subtest has ended. Is followed by the subtest name +* and optionally its runtime. +* +* Examples: +* Subtest subtestname: SKIP +* Subtest subtestname: PASS (0.003s) +*/ +static const char subtest_result[] ="Subtest " ; + +/* +* Output in dmesg when a subtest has begin. Is followed by the subtest name. +* +* Example: +* [IGT] test-binary-name: starting subtest subtestname +*/ +static const char starting_subtest_dmesg[] =": starting subtest " ; + +/* +* Output when a test process is executed. +* +* Example: +* IGT-Version: 1.22-gde9af343 (x86_64) (Linux: 4.12.0-1-amd64 x86_64) +*/ +static const char versionstring[] ="IGT-Version: " ; + +#endif
runner/resultgen.c new file +954 -0
954 lines not on this page · raw message
runner/resultgen.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef RUNNER_RESULTGEN_H +#define RUNNER_RESULTGEN_H + +#include <stdbool.h> + +bool generate_results (int dirfd); +bool generate_results_path (char *resultspath); + +#endif
runner/results.c new file +26 -0
@@ -0,0 +1,26 @@ +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> +#include <sys/types.h> + +#include "resultgen.h" + +int main (int argc,char **argv) +{ +int dirfd; + +if (argc <2 ) +exit (1 ); + + dirfd =open (argv[1 ],O_DIRECTORY |O_RDONLY ); +if (dirfd <0 ) +exit (1 ); + +if (generate_results (dirfd)) { +printf ("Results generated\n" ); +exit (0 ); + } + +exit (1 ); +}
runner/resume.c new file +47 -0
47 lines not on this page · raw message
runner/runner.c new file +40 -0
@@ -0,0 +1,40 @@ +#include <stdio.h> +#include <string.h> + +#include "settings.h" +#include "job_list.h" +#include "executor.h" +#include "resultgen.h" + +int main (int argc,char **argv) +{ +struct settings settings; +struct job_list job_list; +struct execute_state state; + +init_settings (&settings); +init_job_list (&job_list); + +if (!parse_options (argc, argv, &settings)) { +return 1 ; + } + +if (!create_job_list (&job_list, &settings)) { +return 1 ; + } + +if (!initialize_execute_state (&state, &settings, &job_list)) { +return 1 ; + } + +if (!execute (&state, &settings, &job_list)) { +return 1 ; + } + +if (!generate_results_path (settings.results_path)) { +return 1 ; + } + +printf ("Done.\n" ); +return 0 ; +}
runner/settings.c new file +502 -0
251 lines not on this page · raw message
runner/settings.h new file +111 -0
111 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Part of the diff is not shown here. View the raw message.
v2 cover New runner to rule them all, version 2
Addressing Arek's extensive review took some time, but it resulted in much nicer code that's hopefully easier to read and weeded out some bugs. I think I took care of all feedback, but in case I missed some, feel free to repost.
v2 changelog for patch 4/5 makes the commit message a damn essay. That's also the commit message to read if you're wondering what this series is about.
Patch 2/5 is a new one.
Petri Latvala (5):
lib: Print subtest starting/ending line to stderr too
lib: Export igt_gettime and igt_time_elapsed
uwildmat: Case-insensitive test selection
runner: New test runner
runner: Unit tests for the runner
lib/igt_core.c | 38 +- lib/igt_core.h | 20 + lib/uwildmat/uwildmat.c | 11 +- meson.build | 1 + runner/executor.c | 1022 +++++++++++++++++++++++++++++++++++++++++ runner/executor.h | 49 ++ runner/job_list.c | 487 ++++++++++++++++++++ runner/job_list.h | 37 ++ runner/meson.build | 43 ++ runner/output_strings.h | 38 ++ runner/resultgen.c | 954 ++++++++++++++++++++++++++++++++++++++ runner/resultgen.h | 9 + runner/results.c | 26 ++ runner/resume.c | 47 ++ runner/runner.c | 40 ++ runner/runner_tests.c | 969 ++++++++++++++++++++++++++++++++++++++ runner/settings.c | 502 ++++++++++++++++++++ runner/settings.h | 111 +++++ runner/testdata/meson.build | 20 + runner/testdata/no-subtests.c | 6 + runner/testdata/skippers.c | 14 + runner/testdata/successtest.c | 10 + 22 files changed, 4439 insertions(+), 15 deletions(-) create mode 100644 runner/executor.c create mode 100644 runner/executor.h create mode 100644 runner/job_list.c create mode 100644 runner/job_list.h create mode 100644 runner/meson.build create mode 100644 runner/output_strings.h create mode 100644 runner/resultgen.c create mode 100644 runner/resultgen.h create mode 100644 runner/results.c create mode 100644 runner/resume.c create mode 100644 runner/runner.c create mode 100644 runner/runner_tests.c create mode 100644 runner/settings.c create mode 100644 runner/settings.h create mode 100644 runner/testdata/meson.build create mode 100644 runner/testdata/no-subtests.c create mode 100644 runner/testdata/skippers.c create mode 100644 runner/testdata/successtest.c
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v2 2/5 lib: Export igt_gettime and igt_time_elapsed
--- lib/igt_core.c | 23 +++++++++++------------ lib/igt_core.h | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+), 12 deletions(-)
lib/igt_core.c +11 -12
@@ -407,9 +407,8 @@ void igt_kmsg(const char *format, ...)#define time_valid (ts) ((ts)->tv_sec || (ts)->tv_nsec) -static double -time_elapsed (struct timespec *then, -struct timespec * now) +double igt_time_elapsed (struct timespec *then, +struct timespec *now) {double elapsed =-1. ;
@@ -421,7 +420,7 @@ time_elapsed(struct timespec *then,return elapsed; } -static int gettime (struct timespec *ts) +int igt_gettime (struct timespec *ts) {memset (ts,0 ,sizeof (*ts)); errno =0 ;
@@ -454,7 +453,7 @@ uint64_t igt_nsec_elapsed(struct timespec *start) {struct timespec now; -gettime (&now); +igt_gettime (&now);if ((start->tv_sec | start->tv_nsec) ==0 ) { *start = now;return 0 ;
@@ -819,7 +818,7 @@ out:igt_install_exit_handler (common_exit_handler);if (!test_with_subtests) -gettime (&subtest_time); +igt_gettime (&subtest_time);for (i =0 ; (optind + i) < *argc; i++) argv[i +1 ] = argv[optind + i];
@@ -948,7 +947,7 @@ bool __igt_run_subtest(const char *subtest_name)_igt_log_buffer_reset (); -gettime (&subtest_time); +igt_gettime (&subtest_time);return (in_subtest = subtest_name); }
@@ -993,15 +992,15 @@ static void exit_subtest(const char *result) {struct timespec now; -gettime (&now); +igt_gettime (&now);igt_info ("%sSubtest %s: %s (%.3fs)%s\n" , (!__igt_plain_output) ?"\x1b[1m" :"" , - in_subtest, result,time_elapsed (&subtest_time, &now), + in_subtest, result,igt_time_elapsed (&subtest_time, &now), (!__igt_plain_output) ?"\x1b[0m" :"" );fflush (stdout);if (stderr_needs_sentinel)fprintf (stderr,"Subtest %s: %s (%.3fs)\n" , - in_subtest, result,time_elapsed (&subtest_time, &now)); + in_subtest, result,igt_time_elapsed (&subtest_time, &now));igt_terminate_spin_batches ();
@@ -1488,7 +1487,7 @@ void igt_exit(void)struct timespec now;const char *result; -gettime (&now); +igt_gettime (&now);switch (igt_exitcode) {case IGT_EXIT_SUCCESS :
@@ -1505,7 +1504,7 @@ void igt_exit(void) }printf ("%s (%.3fs)\n" , - result,time_elapsed (&subtest_time, &now)); + result,igt_time_elapsed (&subtest_time, &now)); }exit (igt_exitcode);
lib/igt_core.h +20 -0
@@ -928,6 +928,26 @@ extern enum igt_log_level igt_log_level;void igt_set_timeout (unsigned int seconds,const char *op); +/** +* igt_gettime: +* @ts: current monotonic clock reading +* +* Reports the current time in the monotonic clock. +* Returns: 0 on success, -errno on failure. +*/ +int igt_gettime (struct timespec *ts); + +/** +* igt_time_elapsed: +* @then: Earlier timestamp +* @now: Later timestamp +* +* Returns: Time between two timestamps in seconds, as a floating +* point number. +*/ +double igt_time_elapsed (struct timespec *then, +struct timespec *now); +/** * igt_nsec_elapsed: * @start: measure from this point in time
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v2 5/5 runner: Unit tests for the runner
In reply to Petri LatvalaTODO: Unit tests for the results.json file contents.
v2:
- Avoid writing the nul character to mock files
- Properly set up tmpdirs
--- runner/meson.build | 10 + runner/runner_tests.c | 969 ++++++++++++++++++++++++++++++++++++++++++ runner/testdata/meson.build | 20 + runner/testdata/no-subtests.c | 6 + runner/testdata/skippers.c | 14 + runner/testdata/successtest.c | 10 + 6 files changed, 1029 insertions(+) create mode 100644 runner/runner_tests.c create mode 100644 runner/testdata/meson.build create mode 100644 runner/testdata/no-subtests.c create mode 100644 runner/testdata/skippers.c create mode 100644 runner/testdata/successtest.c
runner/meson.build +10 -0
@@ -1,3 +1,5 @@ +subdir('testdata') + jsonc = dependency('json-c', required: true) runnerlib_sources = [ 'settings.c',
@@ -9,6 +11,7 @@ runnerlib_sources = [ 'settings.c', runner_sources = [ 'runner.c' ] resume_sources = [ 'resume.c' ] results_sources = [ 'results.c' ] +runner_test_sources = [ 'runner_tests.c' ] runnerlib = static_library('igt_runner', runnerlib_sources, include_directories : inc,
@@ -31,3 +34,10 @@ results = executable('results', results_sources, install : true, install_dir : bindir, dependencies : igt_deps) + +runner_test = executable('runner_test', runner_test_sources, + c_args : '-DTESTDATA_DIRECTORY="@0@"'.format(testdata_dir), + link_with : runnerlib, + install : false, + dependencies : igt_deps) +test('runner', runner_test)
runner/runner_tests.c new file +969 -0
969 lines not on this page · raw message
runner/testdata/meson.build new file +20 -0
@@ -0,0 +1,20 @@ + +testdata_progs = [ 'successtest', + 'no-subtests', + 'skippers', + ] + +testdata_executables = [] + +foreach prog : testdata_progs + testdata_executables += executable(prog, prog + '.c', + dependencies : igt_deps, + install : false) +endforeach + +testdata_list = custom_target('testdata_testlist', + output : 'test-list.txt', + command : [ gen_testlist, '@OUTPUT@', testdata_progs ], + build_by_default : true) + +testdata_dir = meson.current_build_dir()
runner/testdata/no-subtests.c new file +6 -0
@@ -0,0 +1,6 @@ +#include "igt.h" + +igt_simple_main +{ + +}
runner/testdata/skippers.c new file +14 -0
@@ -0,0 +1,14 @@ +#include "igt.h" + +igt_main +{ + igt_fixture { +igt_require_f (false,"Skipping from fixture\n" ); + } + + igt_subtest("skip-one") +igt_debug ("Should be skipped\n" ); + + igt_subtest("skip-two") +igt_debug ("Should be skipped\n" ); +}
runner/testdata/successtest.c new file +10 -0
@@ -0,0 +1,10 @@ +#include "igt.h" + +igt_main +{ + igt_subtest("first-subtest") +igt_debug ("Running first subtest\n" ); + + igt_subtest("second-subtest") +igt_debug ("Running second subtest\n" ); +}
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for New runner to rule them all, version 2
In reply to Petri Latvala== Series Details ==
== Series Details ==
Series: New runner to rule them all, version 2
URL : https://patchwork.freedesktop.org/series/44683/
State : failure
== Summary ==
IGT patchset build failed on latest successful builde94ce40798e35d2e3c4494f50b617908066bbf8b tests/gem_exec_basic: Wait on outstanding work before returning from test
-x <regex>, --exclude-tests <regex>
Exclude matching tests (can be used more than once)
--abort-on-monitored-error
Abort execution when a fatal condition is detected. <TODO>
-s, --sync Sync results to disk after every test
-l {quiet,verbose,dummy}, --log-level {quiet,verbose,dummy}
Set the logger verbosity level
--test-list TEST_LIST
A file containing a list of tests to run
-o, --overwrite If the results-path already exists, delete it
--ignore-missing Ignored but accepted, for piglit compatibility
Incompatible options:
-m, --multiple-mode Run multiple subtests in the same binary execution.
If a testlist file is given, consecutive subtests are
run in the same execution if they are from the same
binary. Note that in that case relative ordering of the
subtest execution is dictated by the test binary, not
the testlist
--inactivity-timeout <seconds>
Kill the running test after <seconds> of inactivity in
the test's stdout, stderr, or dmesg
--use-watchdog Use hardware watchdog for lethal enforcement of the
above timeout. Killing the test process is still
attempted at timeout trigger.
[test_root] Directory that contains the IGT tests. The environment
variable IGT_TEST_ROOT will be used if set, overriding
this option if given.
(runner_test:44983) CRITICAL: Test assertion failure function __real_main186, file ../runner/runner_tests.c:803:
(runner_test:44983) CRITICAL: Failed assertion: initialize_execute_state(&state, &settings, &list) (runner_test:44983) CRITICAL: Last errno: 2, No such file or directory
Subtest execute-initialize-subtests-complete failed.
**** DEBUG ****
(runner_test:44983) CRITICAL: Test assertion failure function __real_main186, file ../runner/runner_tests.c:803:
(runner_test:44983) CRITICAL: Failed assertion: initialize_execute_state(&state, &settings, &list) (runner_test:44983) CRITICAL: Last errno: 2, No such file or directory
(runner_test:44983) igt_core-INFO: Stack trace:
(runner_test:44983) igt_core-INFO: #0 [__igt_fail_assert+0x180] (runner_test:44983) igt_core-INFO: #1 [__real_main186+0x4dc0] (runner_test:44983) igt_core-INFO: #2 [main+0x44] (runner_test:44983) igt_core-INFO: #3 [__libc_start_main+0xe7] (runner_test:44983) igt_core-INFO: #4 [_start+0x2a]
**** END ****
-------
Full log written to /home/cidrm/igt-gpu-tools/build/meson-logs/testlog.txt
FAILED: meson-test/usr/bin/python3 -u /usr/bin/meson test --no-rebuild --print-errorlogs
ninja: build stopped: subcommand failed.
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH v3 1/1 runner: Unit tests for the runner
In reply to Petri LatvalaTODO: Unit tests for the results.json file contents.
v2:
- Avoid writing the nul character to mock files
- Properly set up tmpdirs
v3:
- Restore the resume-related changes that were lost in rebase
--- runner/meson.build | 10 + runner/runner_tests.c | 973 ++++++++++++++++++++++++++++++++++++++++++ runner/testdata/meson.build | 20 + runner/testdata/no-subtests.c | 6 + runner/testdata/skippers.c | 14 + runner/testdata/successtest.c | 10 + 6 files changed, 1033 insertions(+) create mode 100644 runner/runner_tests.c create mode 100644 runner/testdata/meson.build create mode 100644 runner/testdata/no-subtests.c create mode 100644 runner/testdata/skippers.c create mode 100644 runner/testdata/successtest.c
runner/meson.build +10 -0
@@ -1,3 +1,5 @@ +subdir('testdata') + jsonc = dependency('json-c', required: true) runnerlib_sources = [ 'settings.c',
@@ -9,6 +11,7 @@ runnerlib_sources = [ 'settings.c', runner_sources = [ 'runner.c' ] resume_sources = [ 'resume.c' ] results_sources = [ 'results.c' ] +runner_test_sources = [ 'runner_tests.c' ] runnerlib = static_library('igt_runner', runnerlib_sources, include_directories : inc,
@@ -31,3 +34,10 @@ results = executable('results', results_sources, install : true, install_dir : bindir, dependencies : igt_deps) + +runner_test = executable('runner_test', runner_test_sources, + c_args : '-DTESTDATA_DIRECTORY="@0@"'.format(testdata_dir), + link_with : runnerlib, + install : false, + dependencies : igt_deps) +test('runner', runner_test)
runner/runner_tests.c new file +973 -0
973 lines not on this page · raw message
runner/testdata/meson.build new file +20 -0
@@ -0,0 +1,20 @@ + +testdata_progs = [ 'successtest', + 'no-subtests', + 'skippers', + ] + +testdata_executables = [] + +foreach prog : testdata_progs + testdata_executables += executable(prog, prog + '.c', + dependencies : igt_deps, + install : false) +endforeach + +testdata_list = custom_target('testdata_testlist', + output : 'test-list.txt', + command : [ gen_testlist, '@OUTPUT@', testdata_progs ], + build_by_default : true) + +testdata_dir = meson.current_build_dir()
runner/testdata/no-subtests.c new file +6 -0
@@ -0,0 +1,6 @@ +#include "igt.h" + +igt_simple_main +{ + +}
runner/testdata/skippers.c new file +14 -0
@@ -0,0 +1,14 @@ +#include "igt.h" + +igt_main +{ + igt_fixture { +igt_require_f (false,"Skipping from fixture\n" ); + } + + igt_subtest("skip-one") +igt_debug ("Should be skipped\n" ); + + igt_subtest("skip-two") +igt_debug ("Should be skipped\n" ); +}
runner/testdata/successtest.c new file +10 -0
@@ -0,0 +1,10 @@ +#include "igt.h" + +igt_main +{ + igt_subtest("first-subtest") +igt_debug ("Running first subtest\n" ); + + igt_subtest("second-subtest") +igt_debug ("Running second subtest\n" ); +}
Signature · 6 lines
2.14.1 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v2 4/5] runner: New test runner
In reply to Petri LatvalaQuoting Petri Latvala (2018-06-13 11:07:38)
runner/executor.c line 323
Quoted 4 lines
runner/executor.c new file +4
-0+static int monitor_output (pid_t child, +int outfd,int errfd,int kmsgfd,int sigfd, +int *outputs, +struct settings *settings)
Why? Just integrate watchdog support into the test runner (igt). No watching output required, if we have a long running test that produces no output, it can ping the watchdog itself. If the test itself should not use the watchdog as it only uses the kernel watchdog, again no issue.
I have no idea why owatch was ever used...
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v2 4/5] runner: New test runner
Quoted 6 lines · Chris Wilson
Quoting Petri Latvala (2018-06-13 11:07:38)
runner/executor.c line 323
Quoted 4 lines
runner/executor.c new file +4
-0+static int monitor_output (pid_t child, +int outfd,int errfd,int kmsgfd,int sigfd, +int *outputs, +struct settings *settings)Why? Just integrate watchdog support into the test runner (igt).
You mean into the tests?
Quoted 4 lines
No watching output required, if we have a long running test that produces no output, it can ping the watchdog itself. If the test itself should not use the watchdog as it only uses the kernel watchdog, again no issue.
If the test jams hard, it's unable to ping watchdogs, and we'd like to be able to kill the test in that case, rebooting (via watchdogs) only as the last resort.
If the test doesn't produce any output itself or in kernel messages, an interface could be added where tests could kill(getppid(), SIGUSR1) to tell the runner they're still alive.
Petri
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for New runner to rule them all, version 2
In reply to Petri Latvala== Series Details ==
== Series Details ==
Series: New runner to rule them all, version 2
URL : https://patchwork.freedesktop.org/series/44683/
State : failure
== Summary ==
IGT patchset build failed on latest successful build e4908004547b63131352fbc0ddcdb1d3d55480e0 igt/evictions: Avoid getting killed by the reaper in mlock
-x <regex>, --exclude-tests <regex>
Exclude matching tests (can be used more than once)
--abort-on-monitored-error
Abort execution when a fatal condition is detected. <TODO>
-s, --sync Sync results to disk after every test
-l {quiet,verbose,dummy}, --log-level {quiet,verbose,dummy}
Set the logger verbosity level
--test-list TEST_LIST
A file containing a list of tests to run
-o, --overwrite If the results-path already exists, delete it
--ignore-missing Ignored but accepted, for piglit compatibility
Incompatible options:
-m, --multiple-mode Run multiple subtests in the same binary execution.
If a testlist file is given, consecutive subtests are
run in the same execution if they are from the same
binary. Note that in that case relative ordering of the
subtest execution is dictated by the test binary, not
the testlist
--inactivity-timeout <seconds>
Kill the running test after <seconds> of inactivity in
the test's stdout, stderr, or dmesg
--use-watchdog Use hardware watchdog for lethal enforcement of the
above timeout. Killing the test process is still
attempted at timeout trigger.
[test_root] Directory that contains the IGT tests. The environment
variable IGT_TEST_ROOT will be used if set, overriding
this option if given.
(runner_test:3810) CRITICAL: Test assertion failure function __real_main186, file ../runner/runner_tests.c:803:
(runner_test:3810) CRITICAL: Failed assertion: initialize_execute_state(&state, &settings, &list) (runner_test:3810) CRITICAL: Last errno: 2, No such file or directory
Subtest execute-initialize-subtests-complete failed.
**** DEBUG ****
(runner_test:3810) CRITICAL: Test assertion failure function __real_main186, file ../runner/runner_tests.c:803:
(runner_test:3810) CRITICAL: Failed assertion: initialize_execute_state(&state, &settings, &list) (runner_test:3810) CRITICAL: Last errno: 2, No such file or directory
(runner_test:3810) igt_core-INFO: Stack trace:
(runner_test:3810) igt_core-INFO: #0 [__igt_fail_assert+0x180] (runner_test:3810) igt_core-INFO: #1 [__real_main186+0x4dc0] (runner_test:3810) igt_core-INFO: #2 [main+0x44] (runner_test:3810) igt_core-INFO: #3 [__libc_start_main+0xe7] (runner_test:3810) igt_core-INFO: #4 [_start+0x2a]
**** END ****
-------
Full log written to /home/cidrm/igt-gpu-tools/build/meson-logs/testlog.txt
FAILED: meson-test/usr/bin/python3 -u /usr/bin/meson test --no-rebuild --print-errorlogs
ninja: build stopped: subcommand failed.
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for New runner to rule them all, version 2
In reply to Petri Latvala== Series Details ==
== Series Details ==
Series: New runner to rule them all, version 2
URL : https://patchwork.freedesktop.org/series/44683/
State : failure
== Summary ==
IGT patchset build failed on latest successful build e4908004547b63131352fbc0ddcdb1d3d55480e0 igt/evictions: Avoid getting killed by the reaper in mlock
-x <regex>, --exclude-tests <regex>
Exclude matching tests (can be used more than once)
--abort-on-monitored-error
Abort execution when a fatal condition is detected. <TODO>
-s, --sync Sync results to disk after every test
-l {quiet,verbose,dummy}, --log-level {quiet,verbose,dummy}
Set the logger verbosity level
--test-list TEST_LIST
A file containing a list of tests to run
-o, --overwrite If the results-path already exists, delete it
--ignore-missing Ignored but accepted, for piglit compatibility
Incompatible options:
-m, --multiple-mode Run multiple subtests in the same binary execution.
If a testlist file is given, consecutive subtests are
run in the same execution if they are from the same
binary. Note that in that case relative ordering of the
subtest execution is dictated by the test binary, not
the testlist
--inactivity-timeout <seconds>
Kill the running test after <seconds> of inactivity in
the test's stdout, stderr, or dmesg
--use-watchdog Use hardware watchdog for lethal enforcement of the
above timeout. Killing the test process is still
attempted at timeout trigger.
[test_root] Directory that contains the IGT tests. The environment
variable IGT_TEST_ROOT will be used if set, overriding
this option if given.
(runner_test:6030) CRITICAL: Test assertion failure function __real_main186, file ../runner/runner_tests.c:803:
(runner_test:6030) CRITICAL: Failed assertion: initialize_execute_state(&state, &settings, &list) (runner_test:6030) CRITICAL: Last errno: 2, No such file or directory
Subtest execute-initialize-subtests-complete failed.
**** DEBUG ****
(runner_test:6030) CRITICAL: Test assertion failure function __real_main186, file ../runner/runner_tests.c:803:
(runner_test:6030) CRITICAL: Failed assertion: initialize_execute_state(&state, &settings, &list) (runner_test:6030) CRITICAL: Last errno: 2, No such file or directory
(runner_test:6030) igt_core-INFO: Stack trace:
(runner_test:6030) igt_core-INFO: #0 [__igt_fail_assert+0x180] (runner_test:6030) igt_core-INFO: #1 [__real_main186+0x4dc0] (runner_test:6030) igt_core-INFO: #2 [main+0x44] (runner_test:6030) igt_core-INFO: #3 [__libc_start_main+0xe7] (runner_test:6030) igt_core-INFO: #4 [_start+0x2a]
**** END ****
-------
Full log written to /home/cidrm/igt-gpu-tools/build/meson-logs/testlog.txt
FAILED: meson-test/usr/bin/python3 -u /usr/bin/meson test --no-rebuild --print-errorlogs
ninja: build stopped: subcommand failed.
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v2 4/5] runner: New test runner
In reply to Petri LatvalaQuoted 26 lines · Petri Latvala
This is a new test runner to replace piglit. Piglit has been very useful as a test runner, but certain improvements have been very difficult if possible at all in a generic test running framework.
Important improvements over piglit:
- Faster to launch. Being able to make assumptions about what we're executing makes it possible to save significant amounts of time. For example, a testlist file's line "igt@somebinary@somesubtest" already has all the information we need to construct the correct command line to execute that particular subtest, instead of listing all subtests of all test binaries and mapping them to command lines. Same goes for the regexp filters command line flags -t and -x; If we use -x somebinaryname, we don't need to list subtests from somebinaryname, we already know none of them will get executed.
- Logs of incomplete tests. Piglit collects test output to memory and dumps them to a file when the test is complete. The new runner writes all output to disk immediately.
- Ability to execute multiple subtests in one binary execution. This was possible with piglit, but its semantics made it very hard to implement in practice. For example, having a testlist file not only selected a subset of tests to run, but also mandated that they be executed in the same order.
Quoted 4 lines
- Flexible timeout support. Instead of mandating a time tests cannot exceed, the new runner has a timeout on inactivity. Activity is any output on the test's stdout or stderr, or kernel activity via
/dev/kmsg.
Is there going to be also a (longer) timeout on execution time? It would help if a test is stuck in a loop (e.g. retrying on EAGAIN forever) and is therefore responsive but just not progressing forward.
Thanks,
Antonio
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v2 4/5] runner: New test runner
Quoted 29 lines · Antonio Argenziano
Quoted 26 lines · Petri Latvala
This is a new test runner to replace piglit. Piglit has been very useful as a test runner, but certain improvements have been very difficult if possible at all in a generic test running framework.
Important improvements over piglit:
- Faster to launch. Being able to make assumptions about what we're executing makes it possible to save significant amounts of time. For example, a testlist file's line "igt@somebinary@somesubtest" already has all the information we need to construct the correct command line to execute that particular subtest, instead of listing all subtests of all test binaries and mapping them to command lines. Same goes for the regexp filters command line flags -t and -x; If we use -x somebinaryname, we don't need to list subtests from somebinaryname, we already know none of them will get executed.
- Logs of incomplete tests. Piglit collects test output to memory and dumps them to a file when the test is complete. The new runner writes all output to disk immediately.
- Ability to execute multiple subtests in one binary execution. This was possible with piglit, but its semantics made it very hard to implement in practice. For example, having a testlist file not only selected a subset of tests to run, but also mandated that they be executed in the same order.
Quoted 8 lines
Quoted 4 lines
- Flexible timeout support. Instead of mandating a time tests cannot exceed, the new runner has a timeout on inactivity. Activity is any output on the test's stdout or stderr, or kernel activity via
/dev/kmsg.Is there going to be also a (longer) timeout on execution time? It would help if a test is stuck in a loop (e.g. retrying on EAGAIN forever) and is therefore responsive but just not progressing forward.
What timeout values are used in CI and in which way is still up in the air. With an inactivity timeout (as implemented here) we can have individual tests that run for more than the 10 minutes that piglit enforces (as long as they seem alive), and have timeouts earlier for tests that don't seem active. Other possibilities (in addition to inactivity timeout) are overall timeouts for "full execution of this test list should take 15 minutes total, tops", or having a cap for an individual subtest, an individual binary (all subtests it's going to run in this execution), and combine those with expanding the testlist format to specify the caps based on real data. Meaning,
igt@foobar@frob-some 60
would kill that process after 60 seconds.
Signature · 5 lines
Petri Latvala _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v2 4/5] runner: New test runner
Quoted 39 lines · Petri Latvala
Quoted 29 lines · Antonio Argenziano
Quoted 26 lines · Petri Latvala
This is a new test runner to replace piglit. Piglit has been very useful as a test runner, but certain improvements have been very difficult if possible at all in a generic test running framework.
Important improvements over piglit:
- Faster to launch. Being able to make assumptions about what we're executing makes it possible to save significant amounts of time. For example, a testlist file's line "igt@somebinary@somesubtest" already has all the information we need to construct the correct command line to execute that particular subtest, instead of listing all subtests of all test binaries and mapping them to command lines. Same goes for the regexp filters command line flags -t and -x; If we use -x somebinaryname, we don't need to list subtests from somebinaryname, we already know none of them will get executed.
- Logs of incomplete tests. Piglit collects test output to memory and dumps them to a file when the test is complete. The new runner writes all output to disk immediately.
- Ability to execute multiple subtests in one binary execution. This was possible with piglit, but its semantics made it very hard to implement in practice. For example, having a testlist file not only selected a subset of tests to run, but also mandated that they be executed in the same order.
Quoted 8 lines
Quoted 4 lines
- Flexible timeout support. Instead of mandating a time tests cannot exceed, the new runner has a timeout on inactivity. Activity is any output on the test's stdout or stderr, or kernel activity via
/dev/kmsg.Is there going to be also a (longer) timeout on execution time? It would help if a test is stuck in a loop (e.g. retrying on EAGAIN forever) and is therefore responsive but just not progressing forward.
Quoted 10 lines
What timeout values are used in CI and in which way is still up in the air. With an inactivity timeout (as implemented here) we can have individual tests that run for more than the 10 minutes that piglit enforces (as long as they seem alive), and have timeouts earlier for tests that don't seem active. Other possibilities (in addition to inactivity timeout) are overall timeouts for "full execution of this test list should take 15 minutes total, tops", or having a cap for an individual subtest, an individual binary (all subtests it's going to run in this execution), and combine those with expanding the testlist format to specify the caps based on real data. Meaning,
I would prefer a large per-subtest execution timeout paired with a small inactivity timeout. Where the values of large and small would probably have to be chosen empirically. This way a 'bad' test would fail still but not affect the results from other tests in the same run.
Quoted 2 lines
igt@foobar@frob-some 60
Could this be auto-generated from somewhere?
Thanks,
Antonio
Quoted 4 lines
would kill that process after 60 seconds.
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v2 4/5] runner: New test runner
Quoted 53 lines · Antonio Argenziano
Quoted 39 lines · Petri Latvala
Quoted 29 lines · Antonio Argenziano
Quoted 26 lines · Petri Latvala
This is a new test runner to replace piglit. Piglit has been very useful as a test runner, but certain improvements have been very difficult if possible at all in a generic test running framework.
Important improvements over piglit:
- Faster to launch. Being able to make assumptions about what we're executing makes it possible to save significant amounts of time. For example, a testlist file's line "igt@somebinary@somesubtest" already has all the information we need to construct the correct command line to execute that particular subtest, instead of listing all subtests of all test binaries and mapping them to command lines. Same goes for the regexp filters command line flags -t and -x; If we use -x somebinaryname, we don't need to list subtests from somebinaryname, we already know none of them will get executed.
- Logs of incomplete tests. Piglit collects test output to memory and dumps them to a file when the test is complete. The new runner writes all output to disk immediately.
- Ability to execute multiple subtests in one binary execution. This was possible with piglit, but its semantics made it very hard to implement in practice. For example, having a testlist file not only selected a subset of tests to run, but also mandated that they be executed in the same order.
Quoted 8 lines
Quoted 4 lines
- Flexible timeout support. Instead of mandating a time tests cannot exceed, the new runner has a timeout on inactivity. Activity is any output on the test's stdout or stderr, or kernel activity via
/dev/kmsg.Is there going to be also a (longer) timeout on execution time? It would help if a test is stuck in a loop (e.g. retrying on EAGAIN forever) and is therefore responsive but just not progressing forward.
Quoted 10 lines
What timeout values are used in CI and in which way is still up in the air. With an inactivity timeout (as implemented here) we can have individual tests that run for more than the 10 minutes that piglit enforces (as long as they seem alive), and have timeouts earlier for tests that don't seem active. Other possibilities (in addition to inactivity timeout) are overall timeouts for "full execution of this test list should take 15 minutes total, tops", or having a cap for an individual subtest, an individual binary (all subtests it's going to run in this execution), and combine those with expanding the testlist format to specify the caps based on real data. Meaning,
Quoted 4 lines
I would prefer a large per-subtest execution timeout paired with a small inactivity timeout. Where the values of large and small would probably have to be chosen empirically. This way a 'bad' test would fail still but not affect the results from other tests in the same run.
My preference as well.
Quoted 5 lines
Quoted 3 lines
igt@foobar@frob-some 60
Could this be auto-generated from somewhere?
Yeah, that's what I was trying to say. Those values would be generated from real data from CI.
Signature · 5 lines
Petri Latvala _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v2 4/5] runner: New test runner
Quoting Petri Latvala (2018-06-15 11:53:05)
Quoted 54 lines · Antonio Argenziano
Quoted 53 lines · Petri Latvala
Quoted 49 lines · Antonio Argenziano
Quoted 29 lines · Petri Latvala
Quoted 26 lines
This is a new test runner to replace piglit. Piglit has been very useful as a test runner, but certain improvements have been very difficult if possible at all in a generic test running framework.
Important improvements over piglit:
- Faster to launch. Being able to make assumptions about what we're executing makes it possible to save significant amounts of time. For example, a testlist file's line "igt@somebinary@somesubtest" already has all the information we need to construct the correct command line to execute that particular subtest, instead of listing all subtests of all test binaries and mapping them to command lines. Same goes for the regexp filters command line flags -t and -x; If we use -x somebinaryname, we don't need to list subtests from somebinaryname, we already know none of them will get executed.
- Logs of incomplete tests. Piglit collects test output to memory and dumps them to a file when the test is complete. The new runner writes all output to disk immediately.
- Ability to execute multiple subtests in one binary execution. This was possible with piglit, but its semantics made it very hard to implement in practice. For example, having a testlist file not only selected a subset of tests to run, but also mandated that they be executed in the same order.
Quoted 8 lines
Quoted 4 lines
- Flexible timeout support. Instead of mandating a time tests cannot exceed, the new runner has a timeout on inactivity. Activity is any output on the test's stdout or stderr, or kernel activity via
/dev/kmsg.Is there going to be also a (longer) timeout on execution time? It would help if a test is stuck in a loop (e.g. retrying on EAGAIN forever) and is therefore responsive but just not progressing forward.
What timeout values are used in CI and in which way is still up in the air. With an inactivity timeout (as implemented here) we can have individual tests that run for more than the 10 minutes that piglit enforces (as long as they seem alive), and have timeouts earlier for tests that don't seem active. Other possibilities (in addition to inactivity timeout) are overall timeouts for "full execution of this test list should take 15 minutes total, tops", or having a cap for an individual subtest, an individual binary (all subtests it's going to run in this execution), and combine those with expanding the testlist format to specify the caps based on real data. Meaning,
Quoted 11 lines
Quoted 4 lines
I would prefer a large per-subtest execution timeout paired with a small inactivity timeout. Where the values of large and small would probably have to be chosen empirically. This way a 'bad' test would fail still but not affect the results from other tests in the same run.
My preference as well.
Quoted 3 lines
Quoted 3 lines
igt@foobar@frob-some 60
This parameter then could be passed within a variable to the test. On the GEM side we have a lot of tests that can be budgeted based on available time.
Although, that comes with the caveat of understanding that passing such a test makes the validity of the test depend on the time it's allocated.
So we should maybe track the cumulated runtimes of subtests per machine after such a change, so that we can make some statistical analysis.
Regards, Joonas
Quoted 13 lines
Quoted 2 lines
Could this be auto-generated from somewhere?
Yeah, that's what I was trying to say. Those values would be generated from real data from CI.
Signature · 5 lines
Petri Latvala _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v2 4/5] runner: New test runner
In reply to Petri LatvalaOn Wed, Jun 13, 2018 at 01:07:38PM +0300, Petri Latvala wrote:
<SNIP>
Quoted 30 lines
meson.build +1
-0@@ -136,6 +136,7 @@ subdir('lib') subdir('tests') subdir('benchmarks') subdir('tools') +subdir('runner') if libdrm_intel.found() subdir('assembler') if ['x86', 'x86_64'].contains(host_machine.cpu_family())runner/executor.c new file +12
-0@@ -0,0 +1,1022 @@ +#include <errno.h> +#include <fcntl.h> +#include <linux/watchdog.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sys/select.h> +#include <sys/signalfd.h> +#include <sys/stat.h> +#include <sys/types.h>
runner/executor.c line 22
Quoted 10 lines
runner/executor.c new file +10
-0+#include <sys/utsname.h> +#include <sys/wait.h> +#include <time.h> +#include <unistd.h> + +#include "igt_core.h" +#include "executor.h" +#include "output_strings.h" + +struct watchdogs
I think we can go with static and anonymous struct here to make it more obvious that's intended global state.
runner/executor.c line 26
Quoted 4 lines
runner/executor.c new file +4
-0+{ +int *fds; +size_t num_dogs; +} watchdogs;
And maybe an uppercase name?
<SNIP>
Quoted 7 lines
runner/executor.c new file +7
-0+static bool prune_from_journal (struct job_list_entry *entry,int fd) +{ +char *subtest; +FILE *f; +bool any_pruned = false; + +/*
runner/executor.c line 155
Quoted 10 lines
runner/executor.c new file +10
-0+* Each journal line is a subtest that has been started, or +* the line 'exit:$exitcode (time)', or 'timeout:$exitcode (time)'. +*/ + + f =fdopen (fd,"r" ); +if (!f) +return false; + +while (fscanf (f,"%ms" , &subtest) ==1 ) { +if (!strncmp (subtest,"exit:" ,5 )) {
Defines/static consts for those magic strings? It's easier to strlen() them.
runner/executor.c line 163
Quoted 8 lines
runner/executor.c new file +8
-0+/* Fully done. Mark that by making the binary name invalid. */ +fscanf (f," (%*fs)" ); + entry->binary[0 ] ='\0' ; +free (subtest); +continue ; + } + +if (!strncmp (subtest,"timeout:" ,8 )) {
Same as above.
<SNIP>
Quoted 10 lines
runner/executor.c new file +10
-0+static void dump_dmesg (int kmsgfd,int outfd) +{ +/* +* Write kernel messages to the log file until we reach +* 'now'. Unfortunately, /dev/kmsg doesn't support seeking to +* -1 from SEEK_END so we need to use a second fd to read a +* message to match against, or stop when we reach EAGAIN. +*/ + +int comparefd =open ("/dev/kmsg" ,O_RDONLY |O_NONBLOCK );
runner/executor.c line 252
Quoted 10 lines
runner/executor.c new file +10
-0+unsigned flags; +unsigned long long seq, cmpseq, usec; +char cont; +char buf[256 ]; +ssize_t r; + +if (comparefd <0 ) +return ; + +if (fcntl (kmsgfd,F_SETFL ,O_NONBLOCK ))
According to man, success is indicated by "value other than -1".
Quoted 45 lines
runner/executor.c new file +45
-0+return ; + +while (1 ) { +if (comparefd >=0 ) { + r =read (comparefd, buf,sizeof (buf) -1 ); +if (r <0 ) { +if (errno !=EAGAIN && errno !=EPIPE ) +return ; + }else { + buf[r] ='\0' ; +if (sscanf (buf,"%u,%llu,%llu,%c;" , + &flags, &cmpseq, &usec, &cont) ==4 ) { +/* Reading comparison record done. */ +close (comparefd); + comparefd =-1 ; + } + } + } + + r =read (kmsgfd, buf,sizeof (buf)); +if (r <=0 ) { +if (errno ==EPIPE ) +continue ; + +/* +* If EAGAIN, we're done. If some other error, +* we can't do anything anyway. +*/ +return ; + } + +write (outfd, buf, r); + +if (comparefd <0 &&sscanf (buf,"%u,%llu,%llu,%c;" , + &flags, &seq, &usec, &cont) ==4 ) { +/* +* Comparison record has been read, compare +* the sequence number to see if we have read +* enough. +*/ +if (seq >= cmpseq) +return ; + } + } +}
<SNIP>
Quoted 128 lines
runner/executor.c new file +128
-0+/* +* Returns: +* =0 - Success +* <0 - Failure executing +* >0 - Timeout happened, need to recreate from journal +*/ +static int monitor_output (pid_t child, +int outfd,int errfd,int kmsgfd,int sigfd, +int *outputs, +struct settings *settings) +{ +fd_set set; +char buf[256 ]; +char *outbuf =NULL ; +size_t outbufsize =0 ; +char current_subtest[256 ] = {}; +struct signalfd_siginfo siginfo; +ssize_t s; +int n, status; +int nfds = outfd; +int timeout = settings->inactivity_timeout; +int timeout_intervals =1 , intervals_left; +int wd_extra =10 ; +int killed =0 ;/* 0 if not killed, signal number otherwise */ +struct timespec time_beg, time_end; +bool aborting = false; + +igt_gettime (&time_beg); + +if (errfd > nfds) + nfds = errfd; +if (kmsgfd > nfds) + nfds = kmsgfd; +if (sigfd > nfds) + nfds = sigfd; + nfds++; + +if (timeout >0 ) { +/* +* Use original timeout plus some leeway. If we're still +* alive, we want to kill the test process instead of cutting +* power. +*/ +int wd_timeout =watchdogs_set_timeout (timeout + wd_extra); + +if (wd_timeout < timeout + wd_extra) { +/* Watchdog timeout smaller, so ping it more often */ +if (wd_timeout - wd_extra <0 ) + wd_extra = wd_timeout /2 ; + timeout_intervals = timeout / (wd_timeout - wd_extra); + intervals_left = timeout_intervals; + timeout /= timeout_intervals; + +if (settings->log_level >=LOG_LEVEL_VERBOSE ) { +printf ("Watchdog doesn't support the timeout we requested (shortened to %d seconds).\n" +"Using %d intervals of %d seconds.\n" , + wd_timeout, timeout_intervals, timeout); + } + } + } + +while (outfd >=0 || errfd >=0 || sigfd >=0 ) { +struct timeval tv = { .tv_sec = timeout }; + +FD_ZERO (&set); +if (outfd >=0 ) +FD_SET (outfd, &set); +if (errfd >=0 ) +FD_SET (errfd, &set); +if (kmsgfd >=0 ) +FD_SET (kmsgfd, &set); +if (sigfd >=0 ) +FD_SET (sigfd, &set); + + n =select (nfds, &set,NULL ,NULL , timeout ==0 ?NULL : &tv); +if (n <0 ) { +/* TODO */ +return -1 ; + } + +if (n ==0 ) { + intervals_left--; +if (intervals_left) { +continue ; + } + +ping_watchdogs (); + +switch (killed) { +case 0 : +if (settings->log_level >=LOG_LEVEL_NORMAL ) { +printf ("Timeout. Killing the current test with SIGTERM.\n" ); + } + + killed =SIGTERM ; +if (!kill_child (killed, child)) +return -1 ; + +/* +* Now continue the loop and let the +* dying child be handled normally. +*/ + timeout =2 ;/* Timeout for waiting selected by fair dice roll. */ +watchdogs_set_timeout (20 ); + intervals_left = timeout_intervals =1 ; +break ; +case SIGTERM : +if (settings->log_level >=LOG_LEVEL_NORMAL ) { +printf ("Timeout. Killing the current test with SIGKILL.\n" ); + } + + killed =SIGKILL ; +if (!kill_child (killed, child)) +return -1 ; + + intervals_left = timeout_intervals =1 ; +break ; +case SIGKILL : +/* Nothing that can be done, really. Let's tell the caller we want to abort. */ +if (settings->log_level >=LOG_LEVEL_NORMAL ) { +fprintf (stderr,"Child refuses to die. Aborting.\n" ); + } +close_watchdogs (settings); +free (outbuf); +close (outfd); +close (errfd); +close (kmsgfd); +close (sigfd);
runner/executor.c line 451
Quoted 10 lines
runner/executor.c new file +10
-0+return -1 ; + } + +continue ; + } + + intervals_left = timeout_intervals; +ping_watchdogs (); + +if (outfd >=0 &&FD_ISSET (outfd, &set)) {
I would just break this into smaller functions. You can extract the whole stdout handling as a function of it's own. Same goes for the other fds.
Then this monstrosity would read as a simple dispatcher with timeout handling - much easier to digest.
If you have tried that and this turned out to be a bad idea, then I would appreciate the explanation.
Quoted 18 lines
runner/executor.c new file +18
-0+char *newline; + + s =read (outfd, buf,sizeof (buf)); +if (s <=0 ) { +if (s <0 ) { +fprintf (stderr,"Error reading test's stdout: %s\n" , +strerror (errno)); + } + +close (outfd); + outfd =-1 ; + goto out_end; + } + +write (outputs[_F_OUT], buf, s); +if (settings->sync) { +fdatasync (outputs[_F_OUT]); + }
runner/executor.c line 479
Quoted 10 lines
runner/executor.c new file +10
-0+ + outbuf =realloc (outbuf, outbufsize + s); +memcpy (outbuf + outbufsize, buf, s); + outbufsize += s; + +while ((newline =memchr (outbuf,'\n' , outbufsize)) !=NULL ) { +size_t linelen = newline - outbuf +1 ; + +if (linelen >strlen (starting_subtest) && + !memcmp (outbuf, starting_subtest,strlen (starting_subtest))) {
Uppercase consts, please.
Quoted 148 lines
runner/executor.c new file +148
-0+write (outputs[_F_JOURNAL], outbuf +strlen (starting_subtest), + linelen -strlen (starting_subtest)); +memcpy (current_subtest, outbuf +strlen (starting_subtest), + linelen -strlen (starting_subtest)); + current_subtest[linelen -strlen (starting_subtest)] ='\0' ; + +if (settings->log_level >=LOG_LEVEL_VERBOSE ) { +fwrite (outbuf,1 , linelen, stdout); + } + } +if (linelen >strlen (subtest_result) && + !memcmp (outbuf, subtest_result,strlen (subtest_result))) { +char *delim =memchr (outbuf,':' , linelen); + +if (delim !=NULL ) { +size_t subtestlen = delim - outbuf -strlen (subtest_result); +if (memcmp (current_subtest, outbuf +strlen (subtest_result), + subtestlen)) { +/* Result for a test that didn't ever start */ +write (outputs[_F_JOURNAL], + outbuf +strlen (subtest_result), + subtestlen); +write (outputs[_F_JOURNAL],"\n" ,1 ); +if (settings->sync) { +fdatasync (outputs[_F_JOURNAL]); + } + current_subtest[0 ] ='\0' ; + } + +if (settings->log_level >=LOG_LEVEL_VERBOSE ) { +fwrite (outbuf,1 , linelen, stdout); + } + } + } + +memmove (outbuf, newline +1 , outbufsize - linelen); + outbufsize -= linelen; + } + } + out_end: + +if (errfd >=0 &&FD_ISSET (errfd, &set)) { + s =read (errfd, buf,sizeof (buf)); +if (s <=0 ) { +if (s <0 ) { +fprintf (stderr,"Error reading test's stderr: %s\n" , +strerror (errno)); + } +close (errfd); + errfd =-1 ; + }else { +write (outputs[_F_ERR], buf, s); +if (settings->sync) { +fdatasync (outputs[_F_ERR]); + } + } + } + +if (kmsgfd >=0 &&FD_ISSET (kmsgfd, &set)) { + s =read (kmsgfd, buf,sizeof (buf)); +if (s <0 ) { +if (errno !=EPIPE ) { +fprintf (stderr,"Error reading from kmsg, stopping monitoring: %s\n" , +strerror (errno)); +close (kmsgfd); + kmsgfd =-1 ; + } + }else { +write (outputs[_F_DMESG], buf, s); +if (settings->sync) { +fdatasync (outputs[_F_DMESG]); + } + } + } + +if (sigfd >=0 &&FD_ISSET (sigfd, &set)) { +double time; + + s =read (sigfd, &siginfo,sizeof (siginfo)); +if (s <0 ) { +fprintf (stderr,"Error reading from signalfd: %s\n" , +strerror (errno)); +continue ; + }else if (siginfo.ssi_signo ==SIGCHLD ) { +if (child !=waitpid (child, &status,WNOHANG )) { +fprintf (stderr,"Failed to reap child\n" ); + status =9999 ; + }else if (WIFEXITED (status)) { + status =WEXITSTATUS (status); +if (status >=128 ) { + status =128 - status; + } + }else if (WIFSIGNALED (status)) { + status = -WTERMSIG (status); + }else { + status =9999 ; + } + }else { +/* We're dying, so we're taking them with us */ +if (settings->log_level >=LOG_LEVEL_NORMAL ) +printf ("Abort requested, terminating children\n" ); + + aborting = true; + timeout =2 ; + killed =SIGTERM ; +if (!kill_child (killed, child)) +return -1 ; + +continue ; + } + +igt_gettime (&time_end); + + time =igt_time_elapsed (&time_beg, &time_end); +if (time <0.0 ) + time =0.0 ; + +if (!aborting) { +dprintf (outputs[_F_JOURNAL],"%s:%d (%.3fs)\n" , + killed ?"timeout" :"exit" , + status, time); +if (settings->sync) { +fdatasync (outputs[_F_JOURNAL]); + } + } + +close (sigfd); + sigfd =-1 ; + child =0 ; + } + } + +dump_dmesg (kmsgfd, outputs[_F_DMESG]); +if (settings->sync) +fdatasync (outputs[_F_DMESG]); + +free (outbuf); +close (outfd); +close (errfd); +close (kmsgfd); +close (sigfd); + +if (aborting) +return -1 ; + +return killed; +} +
<SNIP>
Quoted 14 lines
runner/executor.c new file +14
-0+/* +* Returns: +* =0 - Success +* <0 - Failure executing +* >0 - Timeout happened, need to recreate from journal +*/ +static int execute_entry (size_t idx, +size_t total, +struct settings *settings, +struct job_list_entry *entry, +int testdirfd,int resdirfd) +{ +int dirfd; +int outputs[_F_LAST];
runner/executor.c line 706
Quoted 10 lines
runner/executor.c new file +10
-0+int kmsgfd; +int sigfd; +sigset_t mask; +int outpipe[2 ] = {-1 ,-1 }; +int errpipe[2 ] = {-1 ,-1 }; +char name[32 ]; +pid_t child; +int result; + +snprintf (name,32 ,"%zd" , idx);
sizeof
Quoted 89 lines
runner/executor.c new file +89
-0+mkdirat (resdirfd, name,0777 ); +if ((dirfd =openat (resdirfd, name,O_DIRECTORY |O_RDONLY |O_CLOEXEC )) <0 ) { +fprintf (stderr,"Error accessing individual test result directory\n" ); +return -1 ; + } + +if (!open_output_files (dirfd, outputs, true)) { +close (dirfd); +fprintf (stderr,"Error opening output files\n" ); +return -1 ; + } + +if (settings->sync) { +fsync (dirfd); +fsync (resdirfd); + } + +if (pipe (outpipe) ||pipe (errpipe)) { +close_outputs (outputs); +close (dirfd); +close (outpipe[0 ]); +close (outpipe[1 ]); +close (errpipe[0 ]); +close (errpipe[1 ]); +fprintf (stderr,"Error creating pipes: %s\n" ,strerror (errno)); +return -1 ; + } + +if ((kmsgfd =open ("/dev/kmsg" ,O_RDONLY |O_CLOEXEC )) <0 ) { +fprintf (stderr,"Warning: Cannot open /dev/kmsg\n" ); + }else { +/* TODO: Checking of abort conditions in pre-execute dmesg */ +lseek (kmsgfd,0 ,SEEK_END ); + } + +sigemptyset (&mask); +sigaddset (&mask,SIGCHLD ); +sigaddset (&mask,SIGINT ); +sigaddset (&mask,SIGTERM ); +sigaddset (&mask,SIGQUIT ); +sigprocmask (SIG_BLOCK , &mask,NULL ); + sigfd =signalfd (-1 , &mask,O_CLOEXEC ); + +if (sigfd <0 ) { +/* TODO: Handle better */ +fprintf (stderr,"Cannot monitor child process with signalfd\n" ); +close (outpipe[0 ]); +close (errpipe[0 ]); +close (outpipe[1 ]); +close (errpipe[1 ]); +close (kmsgfd); +close_outputs (outputs); +close (dirfd); +return -1 ; + } + +if (settings->log_level >=LOG_LEVEL_NORMAL ) { +int width =digits (total); +printf ("[%0*zd/%0*zd] %s" , width, idx +1 , width, total, entry->binary); +if (entry->subtest_count >0 ) { +size_t i; +char *delim ="" ; + +printf (" (" ); +for (i =0 ; i < entry->subtest_count; i++) { +printf ("%s%s" , delim, entry->subtests[i]); + delim =", " ; + } +printf (")" ); + } +printf ("\n" ); + } + +if ((child =fork ())) { +int outfd = outpipe[0 ]; +int errfd = errpipe[0 ]; +close (outpipe[1 ]); +close (errpipe[1 ]); + + result =monitor_output (child, outfd, errfd, kmsgfd, sigfd, + outputs, settings); + }else { +int outfd = outpipe[1 ]; +int errfd = errpipe[1 ]; +close (outpipe[0 ]); +close (errpipe[0 ]); + +sigprocmask (SIG_UNBLOCK , &mask,NULL ); +
runner/executor.c line 805
Quoted 10 lines
runner/executor.c new file +10
-0+setenv ("IGT_SENTINEL_ON_STDERR" ,"1" ,1 ); + +execute_test_process (outfd, errfd, settings, entry); + } + +close (outpipe[1 ]); +close (errpipe[1 ]); +close (kmsgfd); +close_outputs (outputs); +close (dirfd);
onion teardown? with gotos and all the jazz
Quoted 84 lines
runner/executor.c new file +84
-0+ +return result; +} + +static int remove_file (int dirfd,char *name) +{ +return unlinkat (dirfd, name,0 ) && errno !=ENOENT ; +} + +static bool clear_test_result_directory (int dirfd) +{ +int i; + +for (i =0 ; i < _F_LAST; i++) { +if (remove_file (dirfd, filenames[i])) { +fprintf (stderr,"Error deleting %s from test result directory: %s\n" , + filenames[i], +strerror (errno)); +return false; + } + } + +return true; +} + +static bool clear_old_results (char *path) +{ +int dirfd; +size_t i; + +if ((dirfd =open (path,O_DIRECTORY |O_RDONLY )) <0 ) { +if (errno ==ENOENT ) { +/* Successfully cleared if it doesn't even exist */ +return true; + } + +fprintf (stderr,"Error clearing old results: %s\n" ,strerror (errno)); +return false; + } + +if (unlinkat (dirfd,"uname.txt" ,0 ) && errno !=ENOENT ) { +close (dirfd); +fprintf (stderr,"Error clearing old results: %s\n" ,strerror (errno)); +return false; + } + +for (i =0 ; true; i++) { +char name[32 ]; +int resdirfd; + +snprintf (name,sizeof (name),"%zd" , i); +if ((resdirfd =openat (dirfd, name,O_DIRECTORY |O_RDONLY )) <0 ) +break ; + +if (!clear_test_result_directory (resdirfd)) { +close (resdirfd); +close (dirfd); +return false; + } +close (resdirfd); +if (unlinkat (dirfd, name,AT_REMOVEDIR )) { +fprintf (stderr, +"Warning: Result directory %s contains extra files\n" , + name); + } + } + +close (dirfd); + +return true; +} + +bool initialize_execute_state_from_resume (int dirfd, +struct execute_state *state, +struct settings *settings, +struct job_list *list) +{ +struct job_list_entry *entry; +int resdirfd, fd, i; + +free_settings (settings); +free_job_list (list); +memset (state,0 ,sizeof (*state)); +
runner/executor.c line 899
Quoted 10 lines
runner/executor.c new file +10
-0+if (!read_settings (settings, dirfd) || + !read_job_list (list, dirfd)) { +close (dirfd); +return false; + } + +for (i = list->size; i >=0 ; i--) { +char name[32 ]; + +snprintf (name,32 ,"%d" , i);
sizeof
runner/executor.c line 908
Quoted 9 lines
runner/executor.c new file +9
-0+if ((resdirfd =openat (dirfd, name,O_DIRECTORY |O_RDONLY )) >=0 ) { +break ; + } + } + +if (i <0 ) { +/* Nothing has been executed yet, state is fine as is */ + goto success; + }
kinda uneccesray {}
same for the if a little bit up
Quoted 95 lines
runner/executor.c new file +95
-0+ + entry = &list->entries[i]; + state->next = i; +if ((fd =openat (resdirfd, filenames[_F_JOURNAL],O_RDONLY )) >=0 ) { +if (!prune_from_journal (entry, fd)) { +/* +* The test does not have subtests, or +* incompleted before the first subtest +* began. Either way, not suitable to +* re-run. +*/ + state->next = i +1 ; + }else if (entry->binary[0 ] =='\0' ) { +/* This test is fully completed */ + state->next = i +1 ; + } + +close (fd); + } + + success: +close (resdirfd); +close (dirfd); + +return true; +} + +bool initialize_execute_state (struct execute_state *state, +struct settings *settings, +struct job_list *job_list) +{ +memset (state,0 ,sizeof (*state)); + +if (!validate_settings (settings)) +return false; + +if (!serialize_settings (settings) || + !serialize_job_list (job_list, settings)) +return false; + +if (settings->overwrite && + !clear_old_results (settings->results_path)) +return false; + +return true; +} + +bool execute (struct execute_state *state, +struct settings *settings, +struct job_list *job_list) +{ +struct utsname unamebuf; +int resdirfd, testdirfd, unamefd; + +if ((resdirfd =open (settings->results_path,O_DIRECTORY |O_RDONLY )) <0 ) { +/* Initialize state should have done this */ +fprintf (stderr,"Error: Failure opening results path %s\n" , + settings->results_path); +return false; + } + +if ((testdirfd =open (settings->test_root,O_DIRECTORY |O_RDONLY )) <0 ) { +fprintf (stderr,"Error: Failure opening test root %s\n" , + settings->test_root); +close (resdirfd); +return false; + } + +/* TODO: On resume, don't rewrite, verify that content matches current instead */ +if ((unamefd =openat (resdirfd,"uname.txt" ,O_CREAT |O_WRONLY |O_TRUNC ,0666 )) <0 ) { +fprintf (stderr,"Error: Failure creating opening uname.txt: %s\n" , +strerror (errno)); +close (testdirfd); +close (resdirfd); +return false; + } + +init_watchdogs (settings); + +if (!uname (&unamebuf)) { +dprintf (unamefd,"%s %s %s %s %s\n" , + unamebuf.sysname, + unamebuf.nodename, + unamebuf.release, + unamebuf.version, + unamebuf.machine); + }else { +dprintf (unamefd,"uname() failed\n" ); + } +close (unamefd); + +for (; state->next < job_list->size; + state->next++) { + int result = execute_entry(state->next, + job_list->size,
runner/executor.c line 1013
Quoted 10 lines
runner/executor.c new file +10
-0+ settings, + &job_list->entries[state->next], + testdirfd, resdirfd); +if (result !=0 ) { +close (testdirfd); +close_watchdogs (settings); +if (result >0 ) { +initialize_execute_state_from_resume (resdirfd, state, settings, job_list); +return execute (state, settings, job_list); + }
missing close(resdirfd) ?
Quoted 9 lines
runner/executor.c new file +9
-0+return false; + } + } + +close (testdirfd); +close (resdirfd); +close_watchdogs (settings); +return true; +}
<SNIP>
Quoted 99 lines
runner/job_list.c new file +93
-0@@ -0,0 +1,487 @@ +#include <errno.h> +#include <fcntl.h> +#include <linux/limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +#include "job_list.h" +#include "igt_core.h" + +static bool matches_any (const char *str,struct regex_list *list) +{ +size_t i; + +for (i =0 ; i < list->size; i++) { +if (regexec (list->regexes[i], str, + (size_t )0 ,NULL ,0 ) ==0 ) { +return true; + } + } + +return false; +} + +static void add_job_list_entry (struct job_list *job_list, +char *binary, +char **subtests, +size_t subtest_count) +{ +struct job_list_entry *entry; + + job_list->size++; + job_list->entries =realloc (job_list->entries, job_list->size *sizeof (*job_list->entries)); + entry = &job_list->entries[job_list->size -1 ]; + + entry->binary = binary; + entry->subtests = subtests; + entry->subtest_count = subtest_count; +} + +static void add_subtests (struct job_list *job_list,struct settings *settings, +char *binary, +struct regex_list *include,struct regex_list *exclude) +{ +FILE *p; +char cmd[256 ] = {}; +char *subtestname; +char **subtests =NULL ; +size_t num_subtests =0 ; +int s; + + s =snprintf (cmd,sizeof (cmd),"%s/%s --list-subtests" , + settings->test_root, binary); +if (s <0 ) { +fprintf (stderr,"Failure generating command string, this shouldn't happen.\n" ); +return ; + } + +if (s >=sizeof (cmd)) { +fprintf (stderr,"Path to binary too long, ignoring: %s/%s\n" , + settings->test_root, binary); +return ; + } + + p =popen (cmd,"r" ); +if (!p) { +fprintf (stderr,"popen failed when executing %s: %s\n" , + cmd, +strerror (errno)); +return ; + } + +while (fscanf (p,"%ms" , &subtestname) ==1 ) { +if (exclude && exclude->size &&matches_any (subtestname, exclude)) { +free (subtestname); +continue ; + } + +if (include && include->size && !matches_any (subtestname, include)) { +free (subtestname); +continue ; + } + +if (settings->multiple_mode) { + num_subtests++; + subtests =realloc (subtests, num_subtests *sizeof (*subtests)); + subtests[num_subtests -1 ] =strdup (subtestname); + }else { + subtests =malloc (sizeof (*subtests)); + *subtests =strdup (subtestname);
runner/job_list.c line 103
Quoted 10 lines
runner/job_list.c new file +10
-0+add_job_list_entry (job_list,strdup (binary), subtests,1 ); + subtests =NULL ; + } + +free (subtestname); + } + +if (num_subtests) { +add_job_list_entry (job_list,strdup (binary), subtests, num_subtests); + }
Unecessary {}
Quoted 96 lines
runner/job_list.c new file +96
-0+ + s =pclose (p); +if (s ==0 ) { +return ; + }else if (s ==-1 ) { +fprintf (stderr,"popen error when executing %s: %s\n" , binary,strerror (errno)); + }else if (WIFEXITED (s)) { +if (WEXITSTATUS (s) ==IGT_EXIT_INVALID ) { +/* No subtests on this one */ +if (exclude && exclude->size &&matches_any (binary, exclude)) { +return ; + } +if (!include || !include->size ||matches_any (binary, include)) { +add_job_list_entry (job_list,strdup (binary),NULL ,0 ); +return ; + } + } + }else { +fprintf (stderr,"Test binary %s died unexpectedly\n" , binary); + } +} + +static bool filtered_job_list (struct job_list *job_list, +struct settings *settings, +int fd) +{ +FILE *f; +char buf[128 ]; + +if (job_list->entries !=NULL ) { +fprintf (stderr,"Caller didn't clear the job list, this shouldn't happen\n" ); +exit (1 ); + } + + f =fdopen (fd,"r" ); + +while (fscanf (f,"%127s" , buf) ==1 ) { +if (!strcmp (buf,"TESTLIST" ) || !(strcmp (buf,"END" ))) +continue ; + +/* +* If the binary name matches exclude filters, no +* subtests are added. +*/ +if (settings->exclude_regexes.size &&matches_any (buf, &settings->exclude_regexes)) +continue ; + +/* +* If the binary name matches include filters (or include filters not present), +* all subtests except those matching exclude filters are added. +*/ +if (!settings->include_regexes.size ||matches_any (buf, &settings->include_regexes)) { +if (settings->multiple_mode && !settings->exclude_regexes.size) +/* +* Optimization; we know that all +* subtests will be included, so we +* get to omit executing +* --list-subtests. +*/ +add_job_list_entry (job_list,strdup (buf),NULL ,0 ); +else +add_subtests (job_list, settings, buf, +NULL , &settings->exclude_regexes); +continue ; + } + +/* +* Binary name doesn't match exclude or include filters. +*/ +add_subtests (job_list, settings, buf, + &settings->include_regexes, + &settings->exclude_regexes); + } + +return job_list->size !=0 ; +} + +static bool job_list_from_test_list (struct job_list *job_list, +struct settings *settings) +{ +FILE *f; +char *line =NULL ; +size_t line_len =0 ; +struct job_list_entry entry = {}; +bool any = false; + +if ((f =fopen (settings->test_list,"r" )) ==NULL ) { +fprintf (stderr,"Cannot open test list file %s\n" , settings->test_list); +return false; + } + +while (1 ) { +char *binary; +char *delim; + +if (getline (&line, &line_len, f) ==-1 ) {
runner/job_list.c line 209
Quoted 10 lines
runner/job_list.c new file +10
-0+if (errno ==EINTR ) +continue ; +else +break ; + } + +/* # starts a comment */ +if ((delim =strchr (line,'#' )) !=NULL ) { + *delim ='\0' ; + }
Unecessary {}
And many more, just ag for 'if .* {\n.*\n.*}'
Quoted 72 lines
runner/job_list.c new file +72
-0+ +if (sscanf (line,"igt@%ms" , &binary) ==1 ) { +if ((delim =strchr (binary,'@' )) !=NULL ) { + *delim++ ='\0' ; + } + +if (!settings->multiple_mode) { +char **subtests =NULL ; +if (delim) { + subtests =malloc (sizeof (char *)); + subtests[0 ] =strdup (delim); + } +add_job_list_entry (job_list,strdup (binary), + subtests, (size_t )(subtests !=NULL )); + any = true; +free (binary); + binary =NULL ; +continue ; + } + +/* +* If the currently built entry has the same +* binary, add a subtest. Otherwise submit +* what's already built and start a new one. +*/ +if (entry.binary && !strcmp (entry.binary, binary)) { +if (!delim) { +/* ... except we didn't get a subtest */ +fprintf (stderr, +"Error: Unexpected test without subtests " +"after same test had subtests\n" ); +free (binary); +fclose (f); +return false; + } + entry.subtest_count++; + entry.subtests =realloc (entry.subtests, + entry.subtest_count * +sizeof (*entry.subtests)); + entry.subtests[entry.subtest_count -1 ] =strdup (delim); +free (binary); + binary =NULL ; +continue ; + } + +if (entry.binary) { +add_job_list_entry (job_list, entry.binary, entry.subtests, entry.subtest_count); + any = true; + } + +memset (&entry,0 ,sizeof (entry)); + entry.binary =strdup (binary); +if (delim) { + entry.subtests =malloc (sizeof (*entry.subtests)); + entry.subtests[0 ] =strdup (delim); + entry.subtest_count =1 ; + } + +free (binary); + binary =NULL ; + } + } + +if (entry.binary) { +add_job_list_entry (job_list, entry.binary, entry.subtests, entry.subtest_count); + any = true; + } + +free (line); +fclose (f); +return any; +}
<SNIP>
Quoted 32 lines
runner/output_strings.h new file +26
-0@@ -0,0 +1,38 @@ +#ifndef RUNNER_OUTPUT_STRINGS_H +#define RUNNER_OUTPUT_STRINGS_H + +/* +* Output when a subtest has begun. Is followed by the subtest name. +* +* Example: +* Starting subtest: subtestname +*/ +static const char starting_subtest[] ="Starting subtest: " ; + +/* +* Output when a subtest has ended. Is followed by the subtest name +* and optionally its runtime. +* +* Examples: +* Subtest subtestname: SKIP +* Subtest subtestname: PASS (0.003s) +*/ +static const char subtest_result[] ="Subtest " ; + +/* +* Output in dmesg when a subtest has begin. Is followed by the subtest name. +* +* Example: +* [IGT] test-binary-name: starting subtest subtestname
runner/output_strings.h line 36
Quoted 10 lines
runner/output_strings.h new file +10
-0+*/ +static const char starting_subtest_dmesg[] =": starting subtest " ; + +/* +* Output when a test process is executed. +* +* Example: +* IGT-Version: 1.22-gde9af343 (x86_64) (Linux: 4.12.0-1-amd64 x86_64) +*/ +static const char versionstring[] ="IGT-Version: " ;
What about uppercase consts? :P
Quoted 24 lines
runner/output_strings.h new file +2
-0+ +#endif runner/resultgen.c new file +16
-0@@ -0,0 +1,954 @@ +#include <ctype.h> +#include <fcntl.h> +#include <stdio.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +#include <json.h> + +#include "igt_core.h" +#include "resultgen.h" +#include "settings.h" +#include "executor.h" +#include "output_strings.h"
runner/resultgen.c line 26
Quoted 10 lines
runner/resultgen.c new file +10
-0+ +struct subtests +{ +char **names; +size_t size; +}; + +/* +* A lot of string handling here operates on an mmapped buffer, and +* thus we can't assume nul-terminated strings. Buffers will be passed
'null'
Quoted 85 lines
runner/resultgen.c new file +85
-0+* around as pointer+size, or pointer+pointer-past-the-end, the mem*() +* family of functions is used instead of str*(). +*/ + +static char *find_line_starting_with (char *haystack,const char *needle,char *end) +{ +while (haystack < end) { +char *line_end =memchr (haystack,'\n' , end - haystack); + +if (end - haystack <strlen (needle)) +return NULL ; +if (!memcmp (haystack, needle,strlen (needle))) +return haystack; +if (line_end ==NULL ) +return NULL ; + haystack = line_end +1 ; + } + +return NULL ; +} + +static char *find_line_starting_with_either (char *haystack, +const char *needle1, +const char *needle2, +char *end) +{ +while (haystack < end) { +char *line_end =memchr (haystack,'\n' , end - haystack); +size_t linelen = line_end !=NULL ? line_end - haystack : end - haystack; +if ((linelen >=strlen (needle1) && !memcmp (haystack, needle1,strlen (needle1))) || + (linelen >=strlen (needle2) && !memcmp (haystack, needle2,strlen (needle2)))) +return haystack; + +if (line_end ==NULL ) +return NULL ; + + haystack = line_end +1 ; + } + +return NULL ; +} + +static char *next_line (char *line,char *bufend) +{ +char *ret; + +if (!line) +return NULL ; + + ret =memchr (line,'\n' , bufend - line); +if (ret) + ret++; + +if (ret < bufend) +return ret; +else +return NULL ; +} + +static char *find_line_after_last (char *begin, +const char *needle1, +const char *needle2, +char *end) +{ +char *one, *two; +char *needle1_newline =malloc (strlen (needle1) +2 ); +char *needle2_newline =malloc (strlen (needle2) +2 ); + + needle1_newline[0 ] = needle2_newline[0 ] ='\n' ; +strcpy (needle1_newline +1 , needle1); +strcpy (needle2_newline +1 , needle2); + +while (true) { + one =memmem (begin, end - begin, needle1_newline,strlen (needle1_newline)); + two =memmem (begin, end - begin, needle2_newline,strlen (needle2_newline)); +if (one ==NULL && two ==NULL ) +break ; + +if (one !=NULL && begin < one) + begin = one; +if (two !=NULL && begin < two) + begin = two; + + one =next_line (begin, end); +if (one !=NULL )
runner/resultgen.c line 121
Quoted 10 lines
runner/resultgen.c new file +10
-0+ begin = one; + } +free (needle1_newline); +free (needle2_newline); + + one =memchr (begin,'\n' , end - begin); +if (one !=NULL ) +return ++one; + +return begin;
name "begin" seems odd in the context other than the function prototype.
char *current_pos = begin; /* or something? */
Quoted 49 lines
runner/resultgen.c new file +49
-0+} + +static size_t count_lines (const char *buf,const char *bufend) +{ +size_t ret =0 ; +while (buf < bufend && (buf =memchr (buf,'\n' , bufend - buf)) !=NULL ) { + ret++; + buf++; + } + +return ret; +} + +static char *lowercase (char *str) +{ +char *ret =malloc (strlen (str) +1 ); +char *q = ret; + +while (*str) { +if (isspace (*str)) +break ; + + *q++ =tolower (*str++); + } + *q ='\0' ; + +return ret; +} + +static void append_line (char **buf,size_t *buflen,char *line) +{ +size_t linelen =strlen (line); + + *buf =realloc (*buf, *buflen + linelen +1 ); +strcpy (*buf + *buflen, line); + *buflen += linelen; +} + +static char *generate_piglit_name (char *binary,char *subtest) +{ +static char namebuf[256 ]; + +char *lc_binary =lowercase (binary); +char *lc_subtest =NULL ; + +if (!subtest) { +snprintf (namebuf,sizeof (namebuf),"igt@%s" , lc_binary); +free (lc_binary); +return namebuf;
runner/resultgen.c line 180
Quoted 10 lines
runner/resultgen.c new file +10
-0+ } + + lc_subtest =lowercase (subtest); + +snprintf (namebuf,sizeof (namebuf),"igt@%s@%s" , lc_binary, lc_subtest); + +free (lc_binary); +free (lc_subtest); +return namebuf; +}
pass namebuf as a function argument, instead of returning pointer to the static memory here, so the ownership of memory is obvious from the caller?
runner/resultgen.c line 182
Quoted 2 lines
runner/resultgen.c new file +2
-0+ +static struct {
const
Quoted 183 lines
runner/resultgen.c new file +183
-0+char *output_str; +char *result_str; +} resultmap[] = { + { "SUCCESS", "pass" }, + { "SKIP", "skip" }, + { "FAIL", "fail" }, + { "CRASH", "crash" }, + { "TIMEOUT", "timeout" }, +}; +static void parse_result_string(char *resultstring, size_t len, char **result, double *time) +{ + size_t i; + size_t wordlen = 0; + + while (wordlen < len && !isspace(resultstring[wordlen])) { + wordlen++; + } + + *result = NULL; + for (i = 0; i < (sizeof(resultmap) / sizeof(resultmap[0])); i++) { + if (!strncmp(resultstring, resultmap[i].output_str, wordlen)) { + *result = resultmap[i].result_str; + break; + } + } + + /* If the result string is unknown, use incomplete */ + if (!*result) + *result = "incomplete"; + + /* + * Check for subtest runtime after the result. The string is + * '(' followed by the runtime in seconds as floating point, + * followed by 's)'. + */ + wordlen++; + if (wordlen < len && resultstring[wordlen] == '(') { + wordlen++; + char *dup = malloc(len - wordlen + 1); + memcpy(dup, resultstring + wordlen, len - wordlen); + dup[len - wordlen] = '\0'; + *time = strtod(dup, NULL); + + free(dup); + } +} + +static void parse_subtest_result(char *subtest, char **result, double *time, char *buf, char *bufend) +{ + char *line; + char *line_end; + char *resultstring; + size_t linelen; + size_t subtestlen = strlen(subtest); + + *result = NULL; + *time = 0.0; + + if (!buf) return; + + /* + * The result line structure is: + * + * - The string "Subtest " (`subtest_result` from output_strings.h) + * - The subtest name + * - The characters ':' and ' ' + * - Subtest result string + * - Optional: + * -- The characters ' ' and '(' + * -- Subtest runtime in seconds as floating point + * -- The characters 's' and ')' + * + * Example: + * Subtest subtestname: PASS (0.003s) + */ + + line = find_line_starting_with(buf, subtest_result, bufend); + if (!line) { + *result = "incomplete"; + return; + } + + line_end = memchr(line, '\n', bufend - line); + linelen = line_end != NULL ? line_end - line : bufend - line; + + if (strlen(subtest_result) + subtestlen + strlen(": ") > linelen || + strncmp(line + strlen(subtest_result), subtest, subtestlen)) + return parse_subtest_result(subtest, result, time, line + linelen, bufend); + + resultstring = line + strlen(subtest_result) + subtestlen + strlen(": "); + parse_result_string(resultstring, linelen - (resultstring - line), result, time); +} + +static struct json_object *get_or_create_json_object(struct json_object *base, + char *key) +{ + struct json_object *ret; + + if (json_object_object_get_ex(base, key, &ret)) + return ret; + + ret = json_object_new_object(); + json_object_object_add(base, key, ret); + + return ret; +} + +static void set_result(struct json_object *obj, char *result) +{ + json_object_object_add(obj, "result", + json_object_new_string(result)); +} + +static void add_runtime(struct json_object *obj, double time) +{ + double oldtime; + struct json_object *timeobj = get_or_create_json_object(obj, "time"); + struct json_object *oldend; + + json_object_object_add(timeobj, "__type__", + json_object_new_string("TimeAttribute")); + json_object_object_add(timeobj, "start", + json_object_new_double(0.0)); + + if (!json_object_object_get_ex(timeobj, "end", &oldend)) { + json_object_object_add(timeobj, "end", + json_object_new_double(time)); + return; + } + + /* Add the runtime to the existing runtime. */ + oldtime = json_object_get_double(oldend); + time += oldtime; + json_object_object_add(timeobj, "end", + json_object_new_double(time)); +} + +static void set_runtime(struct json_object *obj, double time) +{ + struct json_object *timeobj = get_or_create_json_object(obj, "time"); + + json_object_object_add(timeobj, "__type__", + json_object_new_string("TimeAttribute")); + json_object_object_add(timeobj, "start", + json_object_new_double(0.0)); + json_object_object_add(timeobj, "end", + json_object_new_double(time)); +} + +static bool fill_from_output(int fd, char *binary, char *key, + struct subtests *subtests, + struct json_object *tests) +{ + char *buf, *bufend; + struct stat statbuf; + char *piglit_name = NULL; + char *igt_version = NULL; + size_t igt_version_len = 0; + struct json_object *current_test = NULL; + size_t i; + + if (fstat(fd, &statbuf)) + return false; + + if (statbuf.st_size != 0) { + buf = mmap(NULL, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0); + if (buf == MAP_FAILED) + return false; + } else { + buf = NULL; + } + + bufend = buf + statbuf.st_size; + + igt_version = find_line_starting_with(buf, versionstring, bufend); + if (igt_version) { + char *newline = memchr(igt_version, '\n', bufend - igt_version); + igt_version_len = newline - igt_version; + } + + if (subtests->size == 0) { + /* No subtests */ + piglit_name = generate_piglit_name(binary, NULL);
runner/resultgen.c line 375
Quoted 10 lines
runner/resultgen.c new file +10
-0+ current_test =get_or_create_json_object (tests, piglit_name); + +json_object_object_add (current_test, key, +json_object_new_string_len (buf, statbuf.st_size)); +if (igt_version) +json_object_object_add (current_test,"igt-version" , +json_object_new_string_len (igt_version, + igt_version_len)); + +return true;
This function runs long and is hard to digest in one reading.
You can make a helper function out of this, to handle no subtests case.
Quoted 87 lines
runner/resultgen.c new file +87
-0+ } + +for (i =0 ; i < subtests->size; i++) { +char *this_sub_begin, *this_sub_result; +char *resulttext; +char *beg, *end, *startline; +double time; +int begin_len; +int result_len; + + piglit_name =generate_piglit_name (binary, subtests->names[i]); + current_test =get_or_create_json_object (tests, piglit_name); + + begin_len =asprintf (&this_sub_begin,"%s%s\n" , starting_subtest, subtests->names[i]); + result_len =asprintf (&this_sub_result,"%s%s: " , subtest_result, subtests->names[i]); + +if (begin_len <0 || result_len <0 ) { +fprintf (stderr,"Failure generating strings\n" ); +return false; + } + + beg =find_line_starting_with (buf, this_sub_begin, bufend); + end =find_line_starting_with (buf, this_sub_result, bufend); + startline = beg; + +free (this_sub_begin); +free (this_sub_result); + +if (beg ==NULL && end ==NULL ) { +/* No output at all */ + beg = bufend; + end = bufend; + } + +if (beg ==NULL ) { +/* +* Subtest didn't start, probably skipped from +* fixture already. Start from the result +* line, it gets adjusted below. +*/ + beg = end; + } + +/* Include the output after the previous subtest output */ + beg =find_line_after_last (buf, + starting_subtest, + subtest_result, + beg); + +if (end ==NULL ) { +/* Incomplete result. Find the next starting subtest or result. */ + end =next_line (startline, bufend); +if (end !=NULL ) { + end =find_line_starting_with_either (end, + starting_subtest, + subtest_result, + bufend); + } +if (end ==NULL ) { + end = bufend; + } + }else { +/* +* Now pointing to the line where this sub's +* result is. We need to include that of +* course. +*/ +char *nexttest =next_line (end, bufend); + +/* Stretch onwards until the next subtest begins or ends */ +if (nexttest !=NULL ) { + nexttest =find_line_starting_with_either (nexttest, + starting_subtest, + subtest_result, + bufend); + } +if (nexttest !=NULL ) { + end = nexttest; + }else { + end = bufend; + } + } + +json_object_object_add (current_test, key, +json_object_new_string_len (beg, end - beg)); + +if (igt_version) {
runner/resultgen.c line 472
Quoted 10 lines
runner/resultgen.c new file +10
-0+json_object_object_add (current_test,"igt-version" , +json_object_new_string_len (igt_version, + igt_version_len)); + } + +if (!json_object_object_get_ex (current_test,"result" ,NULL )) { +parse_subtest_result (subtests->names[i], &resulttext, &time, beg, end); +set_result (current_test, resulttext); +set_runtime (current_test, time); + }
And another one for handling a subtest.
Bonus points for splitting it even further :P
runner/resultgen.c line 485
Quoted 13 lines
runner/resultgen.c new file +13
-0+ } + +return true; +} + +/* +* This regexp controls the kmsg handling. All kernel log records that +* have log level of warning or higher convert the result to +* dmesg-warn/dmesg-fail unless they match this regexp. +* +* TODO: Move this to external files, i915-suppressions.txt, +* general-suppressions.txt et al. +*/
<SNIP>
Whew!
With the missing close():
All the other comments are cosmetic.
Signature · 6 lines
Cheers, Arek _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t v2 4/5] runner: New test runner
Quoting Arkadiusz Hiler (2018-07-25 12:56:14)
Quoted 11 lines · Petri Latvala
runner/executor.c line 22
Quoted 5 lines
runner/executor.c new file +5
-0+#include "igt_core.h" +#include "executor.h" +#include "output_strings.h" + +struct watchdogs I think we can go with static and anonymous struct here to make it more obvious that's intended global state.
Quoted 1 line
+{
struct { /* no new line, it's not a function */
Quoted 5 lines
runner/executor.c line 26
Quoted 3 lines
runner/executor.c new file +3
-0+int *fds; +size_t num_dogs; +} watchdogs;And maybe an uppercase name?
Around here, uppercase is reserved for macros (though safe function like macros are allowed to be lower case). -Chris
_______________________________________________
igt-dev mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev