From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [RFC] [PATCH] tst_kvcmp: Add support for extra kernel versions
Date: Thu, 27 Apr 2017 04:28:27 -0400 (EDT) [thread overview]
Message-ID: <1624205915.3497140.1493281707439.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20170426150641.GA6165@rei.suse.de>
----- Original Message -----
> Hi!
> > > Jan can you please check that everything works fine when specifying extra
> > > version on RHEL? It seems that the only systems that are supported by
> > > extra
> > > kernel versions are RHEL5 and RHEL6 at the moment.
> >
> > Should we print an error also if invalid distro is passed as parameter?
>
> That would need a table of known distros stored into the tst_kvercmp.c
> and function to validate a distribution name, or do I miss something?
+static int compare_kver(const char *cur_kver, char *kver)
+{
+ const char *ver, *exver;
+ const char *distname = tst_kvcmp_distname(cur_kver);
+ int v1, v2, v3;
+
+ ver = strtok(kver, " ");
+
+ while ((exver = strtok(NULL, " "))) {
+ char *exkver = strchr(exver, ':');
+
+ if (!exkver) {
+ fprintf(stderr, "Invalid extra version '%s'\n", exver);
+ exit(2);
+ }
+
+ *(exkver++) = '\0';
+
+ if (!distname || strcmp(distname, exver))
+ continue;
+
+ return tst_kvexcmp(exkver, cur_kver);
+ }
If distname != NULL, that means that this is a distro we recognize.
And if we reached here, after while loop, that means we didn't
match any distro specified in "kver", correct?
So, is it OK to make conclusion, that there is a problem in kver?
if (distname)
fprintf(stderr, "distname: %s didn't match any distro in kver: %s\n", distname, kver);
Regards,
Jan
>
> I guess that we can rewrite the code so that the kernel version
> substring and distro name are stored in an array of structures and loop
> over it so that we can say if it's valid or not but I'm not sure that
> it's worth the work.
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
next prev parent reply other threads:[~2017-04-27 8:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 15:52 [LTP] [RFC] [PATCH] tst_kvcmp: Add support for extra kernel versions Cyril Hrubis
2017-04-24 7:58 ` Jan Stancek
2017-04-26 15:06 ` Cyril Hrubis
2017-04-27 8:28 ` Jan Stancek [this message]
2017-04-27 13:01 ` Cyril Hrubis
2017-04-27 13:21 ` Jan Stancek
2017-04-27 14:52 ` Cyril Hrubis
2017-04-28 6:58 ` Jan Stancek
2017-04-28 15:10 ` Cyril Hrubis
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=1624205915.3497140.1493281707439.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.com \
--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