mbox series

[v4,0/4] yank: Add chardev tests and fixes

Message ID cover.1616744509.git.lukasstraub2@web.de (mailing list archive)
Headers show
Series yank: Add chardev tests and fixes | expand

Message

Lukas Straub March 26, 2021, 7:48 a.m. UTC
Hello Everyone,
These patches increase test coverage for yank, add tests and fix bugs and
crashes in yank in combination with chardev-change.
Please Review.

Regards,
Lukas Straub

Changes:
-v4:
 -test: fix CharChangeTestConfig structs on stack going out of scope
 -test: move after bugfixes

-v3:
 -Base on <cover.1616521341.git.lukasstraub2@web.de>
  ([PATCH 0/2] yank: Always link full yank code)
 -Drop patch 1 (tests: Use the normal yank code instead of stubs in relevant tests)

-v2:
 -test: add license
 -test: factorize testcases to a single function
 -test: test chardev_change with initialization of new chardev failing
 -fix chardev_change with initialization of new chardev failing
 -add reviewed-by and tested-by tags

Based-on: <cover.1616521341.git.lukasstraub2@web.de>
([PATCH 0/2] yank: Always link full yank code)

Lukas Straub (4):
  chardev/char.c: Move object_property_try_add_child out of chardev_new
  chardev/char.c: Always pass id to chardev_new
  chardev: Fix yank with the chardev-change case
  tests: Add tests for yank with the chardev-change case

 MAINTAINERS            |   1 +
 chardev/char-socket.c  |  20 ++++-
 chardev/char.c         |  77 ++++++++++------
 include/chardev/char.h |   3 +
 tests/unit/meson.build |   3 +-
 tests/unit/test-yank.c | 199 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 274 insertions(+), 29 deletions(-)
 create mode 100644 tests/unit/test-yank.c

--
2.30.2

Comments

no-reply@patchew.org March 26, 2021, 8:09 a.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/cover.1616744509.git.lukasstraub2@web.de/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: cover.1616744509.git.lukasstraub2@web.de
Subject: [PATCH v4 0/4] yank: Add chardev tests and fixes

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 - [tag update]      patchew/20210323183701.281152-1-f4bug@amsat.org -> patchew/20210323183701.281152-1-f4bug@amsat.org
 * [new tag]         patchew/cover.1616744509.git.lukasstraub2@web.de -> patchew/cover.1616744509.git.lukasstraub2@web.de
Switched to a new branch 'test'
b0e7602 tests: Add tests for yank with the chardev-change case
f065000 chardev: Fix yank with the chardev-change case
e006dcc chardev/char.c: Always pass id to chardev_new
8a11307 chardev/char.c: Move object_property_try_add_child out of chardev_new

=== OUTPUT BEGIN ===
1/4 Checking commit 8a113074e682 (chardev/char.c: Move object_property_try_add_child out of chardev_new)
2/4 Checking commit e006dccfdf7e (chardev/char.c: Always pass id to chardev_new)
3/4 Checking commit f06500035576 (chardev: Fix yank with the chardev-change case)
4/4 Checking commit b0e7602e4800 (tests: Add tests for yank with the chardev-change case)
ERROR: Macros with multiple statements should be enclosed in a do - while loop
#228: FILE: tests/unit/test-yank.c:179:
+#define CHAR_CHANGE_TEST(name, _old_yank, _new_yank)                           \
+        g_test_add_data_func("/yank/char_change/success/" # name,              \
+                             &(CharChangeTestConfig) { .addr = &tcpaddr,       \
+                                                       .old_yank = (_old_yank),\
+                                                       .new_yank = (_new_yank),\
+                                                       .fail = false },        \
+                             char_change_test);                                \
+        g_test_add_data_func("/yank/char_change/fail/" # name,                 \
+                             &(CharChangeTestConfig) { .addr = &tcpaddr,       \
+                                                       .old_yank = (_old_yank),\
+                                                       .new_yank = (_new_yank),\
+                                                       .fail = true },         \
+                             char_change_test);

total: 1 errors, 0 warnings, 215 lines checked

Patch 4/4 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/cover.1616744509.git.lukasstraub2@web.de/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Lukas Straub March 26, 2021, 8:14 a.m. UTC | #2
On Fri, 26 Mar 2021 01:09:46 -0700 (PDT)
no-reply@patchew.org wrote:

> Patchew URL: https://patchew.org/QEMU/cover.1616744509.git.lukasstraub2@web.de/
> 
> 
> 
> Hi,
> 
> This series seems to have some coding style problems. See output below for
> more information:
> 
> Type: series
> Message-id: cover.1616744509.git.lukasstraub2@web.de
> Subject: [PATCH v4 0/4] yank: Add chardev tests and fixes
> 
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> git rev-parse base > /dev/null || exit 0
> git config --local diff.renamelimit 0
> git config --local diff.renames True
> git config --local diff.algorithm histogram
> ./scripts/checkpatch.pl --mailback base..
> === TEST SCRIPT END ===
> 
> Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
> From https://github.com/patchew-project/qemu
>  - [tag update]      patchew/20210323183701.281152-1-f4bug@amsat.org -> patchew/20210323183701.281152-1-f4bug@amsat.org
>  * [new tag]         patchew/cover.1616744509.git.lukasstraub2@web.de -> patchew/cover.1616744509.git.lukasstraub2@web.de
> Switched to a new branch 'test'
> b0e7602 tests: Add tests for yank with the chardev-change case
> f065000 chardev: Fix yank with the chardev-change case
> e006dcc chardev/char.c: Always pass id to chardev_new
> 8a11307 chardev/char.c: Move object_property_try_add_child out of chardev_new
> 
> === OUTPUT BEGIN ===
> 1/4 Checking commit 8a113074e682 (chardev/char.c: Move object_property_try_add_child out of chardev_new)
> 2/4 Checking commit e006dccfdf7e (chardev/char.c: Always pass id to chardev_new)
> 3/4 Checking commit f06500035576 (chardev: Fix yank with the chardev-change case)
> 4/4 Checking commit b0e7602e4800 (tests: Add tests for yank with the chardev-change case)
> ERROR: Macros with multiple statements should be enclosed in a do - while loop
> #228: FILE: tests/unit/test-yank.c:179:
> +#define CHAR_CHANGE_TEST(name, _old_yank, _new_yank)                           \
> +        g_test_add_data_func("/yank/char_change/success/" # name,              \
> +                             &(CharChangeTestConfig) { .addr = &tcpaddr,       \
> +                                                       .old_yank = (_old_yank),\
> +                                                       .new_yank = (_new_yank),\
> +                                                       .fail = false },        \
> +                             char_change_test);                                \
> +        g_test_add_data_func("/yank/char_change/fail/" # name,                 \
> +                             &(CharChangeTestConfig) { .addr = &tcpaddr,       \
> +                                                       .old_yank = (_old_yank),\
> +                                                       .new_yank = (_new_yank),\
> +                                                       .fail = true },         \
> +                             char_change_test);
> 
> total: 1 errors, 0 warnings, 215 lines checked

This is expected. It needs to be this way so the anonymous structs don't go out of
scope.

Regards,
Lukas Straub

> Patch 4/4 has style problems, please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 
> === OUTPUT END ===
> 
> Test command exited with code: 1
> 
> 
> The full log is available at
> http://patchew.org/logs/cover.1616744509.git.lukasstraub2@web.de/testing.checkpatch/?type=message.
> ---
> Email generated automatically by Patchew [https://patchew.org/].
> Please send your feedback to patchew-devel@redhat.com


--
Marc-André Lureau March 26, 2021, 3:56 p.m. UTC | #3
Hi

On Fri, Mar 26, 2021 at 11:48 AM Lukas Straub <lukasstraub2@web.de> wrote:

> Hello Everyone,
> These patches increase test coverage for yank, add tests and fix bugs and
> crashes in yank in combination with chardev-change.
> Please Review.
>
> Regards,
> Lukas Straub
>
> Changes:
> -v4:
>  -test: fix CharChangeTestConfig structs on stack going out of scope
>  -test: move after bugfixes
>
> -v3:
>  -Base on <cover.1616521341.git.lukasstraub2@web.de>
>   ([PATCH 0/2] yank: Always link full yank code)
>  -Drop patch 1 (tests: Use the normal yank code instead of stubs in
> relevant tests)
>
> -v2:
>  -test: add license
>  -test: factorize testcases to a single function
>  -test: test chardev_change with initialization of new chardev failing
>  -fix chardev_change with initialization of new chardev failing
>  -add reviewed-by and tested-by tags
>
> Based-on: <cover.1616521341.git.lukasstraub2@web.de>
> ([PATCH 0/2] yank: Always link full yank code)
>
> Lukas Straub (4):
>   chardev/char.c: Move object_property_try_add_child out of chardev_new
>   chardev/char.c: Always pass id to chardev_new
>   chardev: Fix yank with the chardev-change case
>   tests: Add tests for yank with the chardev-change case
>
>  MAINTAINERS            |   1 +
>  chardev/char-socket.c  |  20 ++++-
>  chardev/char.c         |  77 ++++++++++------
>  include/chardev/char.h |   3 +
>  tests/unit/meson.build |   3 +-
>  tests/unit/test-yank.c | 199 +++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 274 insertions(+), 29 deletions(-)
>  create mode 100644 tests/unit/test-yank.c
>
> --
> 2.30.2
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Lukas Straub March 26, 2021, 4:07 p.m. UTC | #4
On Fri, 26 Mar 2021 19:56:26 +0400
Marc-André Lureau <marcandre.lureau@gmail.com> wrote:

> Hi
> 
> On Fri, Mar 26, 2021 at 11:48 AM Lukas Straub <lukasstraub2@web.de> wrote:
> 
> > Hello Everyone,
> > These patches increase test coverage for yank, add tests and fix bugs and
> > crashes in yank in combination with chardev-change.
> > Please Review.
> >
> > Regards,
> > Lukas Straub
> >
> > Changes:
> > -v4:
> >  -test: fix CharChangeTestConfig structs on stack going out of scope
> >  -test: move after bugfixes
> >
> > -v3:
> >  -Base on <cover.1616521341.git.lukasstraub2@web.de>
> >   ([PATCH 0/2] yank: Always link full yank code)
> >  -Drop patch 1 (tests: Use the normal yank code instead of stubs in
> > relevant tests)
> >
> > -v2:
> >  -test: add license
> >  -test: factorize testcases to a single function
> >  -test: test chardev_change with initialization of new chardev failing
> >  -fix chardev_change with initialization of new chardev failing
> >  -add reviewed-by and tested-by tags
> >
> > Based-on: <cover.1616521341.git.lukasstraub2@web.de>
> > ([PATCH 0/2] yank: Always link full yank code)
> >
> > Lukas Straub (4):
> >   chardev/char.c: Move object_property_try_add_child out of chardev_new
> >   chardev/char.c: Always pass id to chardev_new
> >   chardev: Fix yank with the chardev-change case
> >   tests: Add tests for yank with the chardev-change case
> >
> >  MAINTAINERS            |   1 +
> >  chardev/char-socket.c  |  20 ++++-
> >  chardev/char.c         |  77 ++++++++++------
> >  include/chardev/char.h |   3 +
> >  tests/unit/meson.build |   3 +-
> >  tests/unit/test-yank.c | 199 +++++++++++++++++++++++++++++++++++++++++
> >  6 files changed, 274 insertions(+), 29 deletions(-)
> >  create mode 100644 tests/unit/test-yank.c
> >
> > --
> > 2.30.2
> >  
> 
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> 

Alright, thank you for reviewing this.

Regards,
Lukas Straub

--