[LTP] [PATCH 1/5] tst_run_shell: Add save_restore parser

Petr Vorel pvorel@suse.cz
Wed Dec 11 00:39:29 CET 2024


Hi Cyril,

...
> +		UJSON_ARR_FOREACH(reader, val) {
> +			if (val->type != UJSON_STR) {
> +				ujson_err(reader, "Expected string!");
> +				return NULL;
> +			}
> +
> +			if (!path) {
> +				path = strdup(val->val_str);
> +			} else if (!flags_set) {
> +				if (!strcmp(val->val_str, "TCONF")) {
> +					flags = TST_SR_TCONF;
> +				} else if (!strcmp(val->val_str, "TBROK")) {
> +					flags = TST_SR_TBROK;
> +				} else if (!strcmp(val->val_str, "SKIP")) {
> +					flags = TST_SR_SKIP;
> +				} else {
> +					ujson_err(reader, "Invalid flags!");
> +					return NULL;
> +				}
> +
> +				flags_set = 1;
> +			} else {
> +				ujson_err(reader, "Expected only two members!");

As I noted at vma05.sh, C API supports 3 members (also value).
Maybe vma05.sh does not need it, but wouldn't be better to support it?

Otherwise LGTM.

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Also, while you at it:

-struct tst_test test = {
+static struct tst_test test = {


Kind regards,
Petr


More information about the ltp mailing list