mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 09:56:22 +00:00
lib: validate subtest names
Subtest names should only contain '-', '_' and alphanumeric characters. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
parent
61737903ad
commit
2b05ecfb06
@ -54,6 +54,7 @@
|
|||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "drmtest.h"
|
#include "drmtest.h"
|
||||||
#include "intel_chipset.h"
|
#include "intel_chipset.h"
|
||||||
@ -693,10 +694,21 @@ void igt_simple_init_parse_opts(int argc, char **argv,
|
|||||||
*/
|
*/
|
||||||
bool __igt_run_subtest(const char *subtest_name)
|
bool __igt_run_subtest(const char *subtest_name)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
assert(!in_subtest);
|
assert(!in_subtest);
|
||||||
assert(!in_fixture);
|
assert(!in_fixture);
|
||||||
assert(test_with_subtests);
|
assert(test_with_subtests);
|
||||||
|
|
||||||
|
/* check the subtest name only contains a-z, A-Z, 0-9, '-' and '_' */
|
||||||
|
for (i = 0; subtest_name[i] != '\0'; i++)
|
||||||
|
if (subtest_name[i] != '_' && subtest_name[i] != '-'
|
||||||
|
&& !isalnum(subtest_name[i])) {
|
||||||
|
igt_critical("Invalid subtest name \"%s\".\n",
|
||||||
|
subtest_name);
|
||||||
|
igt_exit();
|
||||||
|
}
|
||||||
|
|
||||||
if (list_subtests) {
|
if (list_subtests) {
|
||||||
printf("%s\n", subtest_name);
|
printf("%s\n", subtest_name);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user