All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Richard Palethorpe <rpalethorpe@suse.com>
Cc: ltp@lists.linux.it, Oliver Hartkopp <socketcan@hartkopp.net>,
	linux-can@vger.kernel.org
Subject: Re: [LTP] [PATCH v2 2/6] can: Add can_common.h for vcan device setup
Date: Tue, 19 Jan 2021 19:05:57 +0100	[thread overview]
Message-ID: <YAcfhf2qg5q4VZrg@pevik> (raw)
In-Reply-To: <20210119093143.17222-3-rpalethorpe@suse.com>

Hi Richie,

...
> +#include <linux/if.h>
...
> +static void can_setup_vcan(void)
> +{
...
> +check_echo:
> +	/* Precondition for the frame flow test? */
> +	SAFE_ASPRINTF(&path, "/sys/class/net/%s/flags", can_dev_name);
> +	if (FILE_SCANF(path, "%x", &flags) || !(flags & IFF_ECHO))
FYI IFF_ECHO is not defined on some older toolchains (aarch64).
It'd be good to add lapi/if.h, where it'd be defined.
But it can be added later.

In file included from can_common.h:21,
                 from can_filter.c:12:
can_common.h: In function ‘can_setup_vcan’:
can_common.h:58:50: error: ‘IFF_ECHO’ undeclared (first use in this function); did you mean ‘IFF_DEBUG’?
  if (FILE_SCANF(path, "%x", &flags) || !(flags & IFF_ECHO))
                                                  ^~~~~~~~
can_common.h:58:50: note: each undeclared identifier is reported only once for each function it appears in
In file included from can_common.h:21,
                 from can_rcv_own_msgs.c:12:
can_common.h: In function ‘can_setup_vcan’:
can_common.h:58:50: error: ‘IFF_ECHO’ undeclared (first use in this function); did you mean ‘IFF_DEBUG’?
  if (FILE_SCANF(path, "%x", &flags) || !(flags & IFF_ECHO))
                                                  ^~~~~~~~

Also there are other problems on toolchains with older linux headers
- bug in using <net/if.h> with <linux/if.h>. Can't we just use <linux/if.h>?
https://travis-ci.org/github/pevik/ltp/jobs/755163076

In file included from /usr/src/ltp/testcases/network/can/filter-tests/can_common.h:15:0,
                 from /usr/src/ltp/testcases/network/can/filter-tests/can_filter.c:12:
/usr/include/linux/if.h:71:2: error: redeclaration of enumerator 'IFF_UP'
  IFF_UP    = 1<<0,  /* sysfs */
  ^
/usr/include/net/if.h:44:5: note: previous definition of 'IFF_UP' was here
     IFF_UP = 0x1,  /* Interface is up.  */
     ^
/usr/include/linux/if.h:72:2: error: redeclaration of enumerator 'IFF_BROADCAST'
  IFF_BROADCAST   = 1<<1,  /* __volatile__ */
  ^
/usr/include/net/if.h:46:5: note: previous definition of 'IFF_BROADCAST' was here
     IFF_BROADCAST = 0x2, /* Broadcast address valid.  */
     ^
/usr/include/linux/if.h:73:2: error: redeclaration of enumerator 'IFF_DEBUG'
  IFF_DEBUG   = 1<<2,  /* sysfs */
  ^
/usr/include/net/if.h:48:5: note: previous definition of 'IFF_DEBUG' was here
     IFF_DEBUG = 0x4,  /* Turn on debugging.  */
     ^
/usr/include/linux/if.h:74:2: error: redeclaration of enumerator 'IFF_LOOPBACK'
  IFF_LOOPBACK   = 1<<3,  /* __volatile__ */
  ^
/usr/include/net/if.h:50:5: note: previous definition of 'IFF_LOOPBACK' was here
     IFF_LOOPBACK = 0x8,  /* Is a loopback net.  */
     ^
/usr/include/linux/if.h:75:2: error: redeclaration of enumerator 'IFF_POINTOPOINT'
  IFF_POINTOPOINT   = 1<<4,  /* __volatile__ */
  ^
/usr/include/net/if.h:52:5: note: previous definition of 'IFF_POINTOPOINT' was here
     IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link.  */
     ^
/usr/include/linux/if.h:76:2: error: redeclaration of enumerator 'IFF_NOTRAILERS'
  IFF_NOTRAILERS   = 1<<5,  /* sysfs */
  ^
/usr/include/net/if.h:54:5: note: previous definition of 'IFF_NOTRAILERS' was here
     IFF_NOTRAILERS = 0x20, /* Avoid use of trailers.  */
     ^
/usr/include/linux/if.h:77:2: error: redeclaration of enumerator 'IFF_RUNNING'
  IFF_RUNNING   = 1<<6,  /* __volatile__ */

Also it fails to run docparse:
invalid character encountered while parsing JSON string, at character offset 133249 (before "\tCAN device name"\n...") at /usr/src/ltp/docparse/testinfo.pl line 398.
make[1]: *** [/usr/src/ltp/docparse/Makefile:60: txt] Error 255
I'll have look into this one.

Kind regards,
Petr

WARNING: multiple messages have this Message-ID (diff)
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/6] can: Add can_common.h for vcan device setup
Date: Tue, 19 Jan 2021 19:05:57 +0100	[thread overview]
Message-ID: <YAcfhf2qg5q4VZrg@pevik> (raw)
In-Reply-To: <20210119093143.17222-3-rpalethorpe@suse.com>

Hi Richie,

...
> +#include <linux/if.h>
...
> +static void can_setup_vcan(void)
> +{
...
> +check_echo:
> +	/* Precondition for the frame flow test? */
> +	SAFE_ASPRINTF(&path, "/sys/class/net/%s/flags", can_dev_name);
> +	if (FILE_SCANF(path, "%x", &flags) || !(flags & IFF_ECHO))
FYI IFF_ECHO is not defined on some older toolchains (aarch64).
It'd be good to add lapi/if.h, where it'd be defined.
But it can be added later.

In file included from can_common.h:21,
                 from can_filter.c:12:
can_common.h: In function ?can_setup_vcan?:
can_common.h:58:50: error: ?IFF_ECHO? undeclared (first use in this function); did you mean ?IFF_DEBUG??
  if (FILE_SCANF(path, "%x", &flags) || !(flags & IFF_ECHO))
                                                  ^~~~~~~~
can_common.h:58:50: note: each undeclared identifier is reported only once for each function it appears in
In file included from can_common.h:21,
                 from can_rcv_own_msgs.c:12:
can_common.h: In function ?can_setup_vcan?:
can_common.h:58:50: error: ?IFF_ECHO? undeclared (first use in this function); did you mean ?IFF_DEBUG??
  if (FILE_SCANF(path, "%x", &flags) || !(flags & IFF_ECHO))
                                                  ^~~~~~~~

Also there are other problems on toolchains with older linux headers
- bug in using <net/if.h> with <linux/if.h>. Can't we just use <linux/if.h>?
https://travis-ci.org/github/pevik/ltp/jobs/755163076

In file included from /usr/src/ltp/testcases/network/can/filter-tests/can_common.h:15:0,
                 from /usr/src/ltp/testcases/network/can/filter-tests/can_filter.c:12:
/usr/include/linux/if.h:71:2: error: redeclaration of enumerator 'IFF_UP'
  IFF_UP    = 1<<0,  /* sysfs */
  ^
/usr/include/net/if.h:44:5: note: previous definition of 'IFF_UP' was here
     IFF_UP = 0x1,  /* Interface is up.  */
     ^
/usr/include/linux/if.h:72:2: error: redeclaration of enumerator 'IFF_BROADCAST'
  IFF_BROADCAST   = 1<<1,  /* __volatile__ */
  ^
/usr/include/net/if.h:46:5: note: previous definition of 'IFF_BROADCAST' was here
     IFF_BROADCAST = 0x2, /* Broadcast address valid.  */
     ^
/usr/include/linux/if.h:73:2: error: redeclaration of enumerator 'IFF_DEBUG'
  IFF_DEBUG   = 1<<2,  /* sysfs */
  ^
/usr/include/net/if.h:48:5: note: previous definition of 'IFF_DEBUG' was here
     IFF_DEBUG = 0x4,  /* Turn on debugging.  */
     ^
/usr/include/linux/if.h:74:2: error: redeclaration of enumerator 'IFF_LOOPBACK'
  IFF_LOOPBACK   = 1<<3,  /* __volatile__ */
  ^
/usr/include/net/if.h:50:5: note: previous definition of 'IFF_LOOPBACK' was here
     IFF_LOOPBACK = 0x8,  /* Is a loopback net.  */
     ^
/usr/include/linux/if.h:75:2: error: redeclaration of enumerator 'IFF_POINTOPOINT'
  IFF_POINTOPOINT   = 1<<4,  /* __volatile__ */
  ^
/usr/include/net/if.h:52:5: note: previous definition of 'IFF_POINTOPOINT' was here
     IFF_POINTOPOINT = 0x10, /* Interface is point-to-point link.  */
     ^
/usr/include/linux/if.h:76:2: error: redeclaration of enumerator 'IFF_NOTRAILERS'
  IFF_NOTRAILERS   = 1<<5,  /* sysfs */
  ^
/usr/include/net/if.h:54:5: note: previous definition of 'IFF_NOTRAILERS' was here
     IFF_NOTRAILERS = 0x20, /* Avoid use of trailers.  */
     ^
/usr/include/linux/if.h:77:2: error: redeclaration of enumerator 'IFF_RUNNING'
  IFF_RUNNING   = 1<<6,  /* __volatile__ */

Also it fails to run docparse:
invalid character encountered while parsing JSON string, at character offset 133249 (before "\tCAN device name"\n...")@/usr/src/ltp/docparse/testinfo.pl line 398.
make[1]: *** [/usr/src/ltp/docparse/Makefile:60: txt] Error 255
I'll have look into this one.

Kind regards,
Petr

  reply	other threads:[~2021-01-19 18:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19  9:31 [PATCH v2 0/6] Convert CAN tests to new LTP API Richard Palethorpe
2021-01-19  9:31 ` [LTP] " Richard Palethorpe
2021-01-19  9:31 ` [PATCH v2 1/6] API: Add FILE_SCANF to new lib Richard Palethorpe
2021-01-19  9:31   ` [LTP] " Richard Palethorpe
2021-01-19  9:31 ` [PATCH v2 2/6] can: Add can_common.h for vcan device setup Richard Palethorpe
2021-01-19  9:31   ` [LTP] " Richard Palethorpe
2021-01-19 18:05   ` Petr Vorel [this message]
2021-01-19 18:05     ` Petr Vorel
2021-01-19  9:31 ` [PATCH v2 3/6] can_filter: Convert to new library Richard Palethorpe
2021-01-19  9:31   ` [LTP] " Richard Palethorpe
2021-01-19  9:31 ` [PATCH v2 4/6] can_recv_own_msgs: " Richard Palethorpe
2021-01-19  9:31   ` [LTP] " Richard Palethorpe
2021-01-19 14:53   ` Marc Kleine-Budde
2021-01-19 14:53     ` [LTP] " Marc Kleine-Budde
2021-01-19 15:06     ` Cyril Hrubis
2021-01-19 15:06       ` Cyril Hrubis
2021-01-19 15:09       ` Marc Kleine-Budde
2021-01-19 15:09         ` Marc Kleine-Budde
2021-01-19 16:34         ` Richard Palethorpe
2021-01-19 16:34           ` Richard Palethorpe
2021-01-19 16:39           ` Marc Kleine-Budde
2021-01-19 16:39             ` Marc Kleine-Budde
2021-01-19 21:34             ` Oliver Hartkopp
2021-01-19 21:34               ` Oliver Hartkopp
2021-01-19  9:31 ` [PATCH v2 5/6] can: Remove obsolete test wrapper script Richard Palethorpe
2021-01-19  9:31   ` [LTP] " Richard Palethorpe
2021-01-19  9:31 ` [PATCH v2 6/6] can: Update contact details Richard Palethorpe
2021-01-19  9:31   ` [LTP] " Richard Palethorpe

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=YAcfhf2qg5q4VZrg@pevik \
    --to=pvorel@suse.cz \
    --cc=linux-can@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=rpalethorpe@suse.com \
    --cc=socketcan@hartkopp.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.