ltp.lists.linux.it archive mirror
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 03/11] docparse: Add test documentation parser
Date: Wed, 4 Nov 2020 17:37:13 +0100	[thread overview]
Message-ID: <20201104163713.GA1034@pevik> (raw)
In-Reply-To: <CAEemH2dx2wYT0dHcDnFnZ0sqY8MO1QOb1-qEmgRSPdFLO=9NUw@mail.gmail.com>

Hi Li,

...
> > IMHO this change (adding buf[i++] = c;), which Li suggested,
> > is causing build failures:
> > https://travis-ci.org/github/pevik/ltp/builds/741217630

> > /usr/src/ltp/docparse/testinfo.pl metadata.json
> > , or ] expected while parsing array, at character offset 340 (before
> > "",\n      "0c461cb72...") at /usr/src/ltp/docparse/testinfo.pl line 379.
> > make[1]: *** [/usr/src/ltp/docparse/Makefile:60: txt] Error 255
> > make[1]: Leaving directory '/usr/src/ltp-build/docparse'
> > make: *** [/usr/src/ltp/Makefile:108: docparse-all] Error 2
> > make: *** Waiting for unfinished jobs....


> Sorry for the error, it because of wrongly parsed tst_test struct with
> including .min_kver = "2.6.32",  then output into metada.json like:

> # cat metadata.json
> ...
>   "cpuset01": {
>    "needs_root": "1",
>    "forks_child": "1",
>    "min_kver": "2.6.32"",  <====== here has two "" in the end
>    "fname": "testcases/kernel/mem/cpuset/cpuset01.c"
>   },

> So the "$(abs_srcdir)/testinfo.pl metadata.json" in Makefile report failure
> as above.

> ==========

> Another fix I can think of is just to avoid return NULL if detecting in the
> string("").
> Hope this will work for us, I will help to check it again tomorrow.

> --- a/docparse/docparse.c
> +++ b/docparse/docparse.c
> @@ -138,10 +138,8 @@ const char *next_token(FILE *f, struct data_node *doc)

>                 if (in_str) {
>                         if (c == '"') {
> -                               if (i == 0 || buf[i-1] != '\\') {
> -                                       buf[i++] = c;
> +                               if (i == 0 || buf[i-1] != '\\')
>                                         goto exit;
> -                               }
>                         }

>                         buf[i++] = c;
> @@ -189,7 +187,7 @@ const char *next_token(FILE *f, struct data_node *doc)
>         }

>  exit:
> -       if (i == 0)
> +       if (i == 0 && !in_str)
>                 return NULL;

>         buf[i] = 0;

Thanks for explanation. Yes, that's a working solution:
https://travis-ci.org/github/pevik/ltp/builds/741418867

Kind regards,
Petr

  reply	other threads:[~2020-11-04 16:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 19:13 [LTP] [PATCH v2 00/11] Test metadata extraction Petr Vorel
2020-11-03 19:13 ` [LTP] [PATCH v2 01/11] make: Support compiling native build tools Petr Vorel
2020-11-03 19:13 ` [LTP] [PATCH v2 02/11] travis: Add git Petr Vorel
2020-11-03 19:13 ` [LTP] [PATCH v2 03/11] docparse: Add test documentation parser Petr Vorel
2020-11-04  7:30   ` Petr Vorel
2020-11-04 13:20     ` Li Wang
2020-11-04 16:37       ` Petr Vorel [this message]
2020-11-03 19:13 ` [LTP] [PATCH v2 04/11] docparse: Add README Petr Vorel
2020-11-03 19:13 ` [LTP] [PATCH v2 05/11] syscalls: Add a few documentation comments Petr Vorel
2020-11-04 11:34   ` Radoslav Kolev
2020-11-04 15:54     ` Petr Vorel
2020-11-05 12:48     ` Cyril Hrubis
2020-11-05 12:48       ` Petr Vorel
2020-11-03 19:13 ` [LTP] [PATCH v2 06/11] syscalls: Move needs_drivers inside of the tst_test struct Petr Vorel
2020-11-03 19:13 ` [LTP] [PATCH v2 07/11] make: Allow {INSTALL, MAKE}_TARGETS be a directory Petr Vorel
2020-11-03 19:13 ` [LTP] [PATCH v2 08/11] make: Allow CLEAN_TARGETS to remove directories Petr Vorel
2020-11-03 19:13 ` [LTP] [PATCH v2 09/11] travis: Install docparse dependencies Petr Vorel
2020-11-03 19:13 ` [LTP] [PATCH v2 10/11] docparse: Add configure options Petr Vorel
2020-11-03 19:13 ` [LTP] [PATCH v2 11/11] docparse: Generate html and pdf using asciidoc{, tor} Petr Vorel
2020-11-12 13:11 ` [LTP] [PATCH v2 00/11] Test metadata extraction Petr Vorel
2020-11-13 17:06   ` Petr Vorel
2020-11-16  6:21     ` Li Wang
2020-11-16  6:30       ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201104163713.GA1034@pevik \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).