All of lore.kernel.org
 help / color / mirror / Atom feed
* [pseudo][PATCH] test: Add missing test-statx test case
@ 2021-08-11 16:41 Philip Lorenz
  2021-08-11 17:19 ` [OE-core] " Mike Crowe
  0 siblings, 1 reply; 3+ messages in thread
From: Philip Lorenz @ 2021-08-11 16:41 UTC (permalink / raw)
  To: openembedded-core; +Cc: Philip Lorenz

Adding this test case was erroneously omitted in
7c722296879906fe093e1e7c4b7537e150d492cd.

Signed-off-by: Philip Lorenz <philip@bithub.de>
---
 test/test-statx.c  | 20 ++++++++++++++++++++
 test/test-statx.sh |  6 ++++++
 2 files changed, 26 insertions(+)
 create mode 100644 test/test-statx.c
 create mode 100755 test/test-statx.sh

diff --git a/test/test-statx.c b/test/test-statx.c
new file mode 100644
index 0000000..06d86af
--- /dev/null
+++ b/test/test-statx.c
@@ -0,0 +1,20 @@
+/*
+ * Test that passing NULL to a parameter marked as nonnull works correctly
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ */
+#define _GNU_SOURCE
+
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+// Passing a null pointer is the test scenario
+#pragma GCC diagnostic ignored "-Wnonnull"
+
+int main(void) {
+    if (statx(0, NULL, 0, 0, NULL) != -1) {
+        return 1;
+    }
+    return 0;
+}
diff --git a/test/test-statx.sh b/test/test-statx.sh
new file mode 100755
index 0000000..77d0302
--- /dev/null
+++ b/test/test-statx.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+#
+# SPDX-License-Identifier: LGPL-2.1-only
+#
+
+exec ./test/test-statx
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [pseudo][PATCH] test: Add missing test-statx test case
  2021-08-11 16:41 [pseudo][PATCH] test: Add missing test-statx test case Philip Lorenz
@ 2021-08-11 17:19 ` Mike Crowe
  2021-08-15 12:50   ` Philip Lorenz
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Crowe @ 2021-08-11 17:19 UTC (permalink / raw)
  To: Philip Lorenz; +Cc: openembedded-core

On Wednesday 11 August 2021 at 18:41:32 +0200, Philip Lorenz wrote:
> Adding this test case was erroneously omitted in
> 7c722296879906fe093e1e7c4b7537e150d492cd.
> 
> Signed-off-by: Philip Lorenz <philip@bithub.de>
> ---
>  test/test-statx.c  | 20 ++++++++++++++++++++
>  test/test-statx.sh |  6 ++++++
>  2 files changed, 26 insertions(+)
>  create mode 100644 test/test-statx.c
>  create mode 100755 test/test-statx.sh
> 
> diff --git a/test/test-statx.c b/test/test-statx.c
> new file mode 100644
> index 0000000..06d86af
> --- /dev/null
> +++ b/test/test-statx.c
> @@ -0,0 +1,20 @@
> +/*
> + * Test that passing NULL to a parameter marked as nonnull works correctly
> + * SPDX-License-Identifier: LGPL-2.1-only
> + *
> + */
> +#define _GNU_SOURCE
> +
> +#include <sys/stat.h>
> +#include <unistd.h>
> +#include <fcntl.h>
> +
> +// Passing a null pointer is the test scenario
> +#pragma GCC diagnostic ignored "-Wnonnull"
> +
> +int main(void) {
> +    if (statx(0, NULL, 0, 0, NULL) != -1) {
> +        return 1;
> +    }
> +    return 0;
> +}
> diff --git a/test/test-statx.sh b/test/test-statx.sh
> new file mode 100755
> index 0000000..77d0302
> --- /dev/null
> +++ b/test/test-statx.sh
> @@ -0,0 +1,6 @@
> +#!/bin/bash
> +#
> +# SPDX-License-Identifier: LGPL-2.1-only
> +#
> +
> +exec ./test/test-statx
> -- 
> 2.32.0
> 

> 
> 
> 

Applying this patch (along with <169A4FE272BB166C.28384@lists.openembedded.org>)
makes all the tests pass for me. However, the run of test-statx.sh causes:

 couldn't allocate absolute path for '(null)'.

to be printed.

Thanks.

Mike.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [pseudo][PATCH] test: Add missing test-statx test case
  2021-08-11 17:19 ` [OE-core] " Mike Crowe
@ 2021-08-15 12:50   ` Philip Lorenz
  0 siblings, 0 replies; 3+ messages in thread
From: Philip Lorenz @ 2021-08-15 12:50 UTC (permalink / raw)
  To: Mike Crowe; +Cc: openembedded-core

On 11.08.21 19:19, Mike Crowe wrote:
> On Wednesday 11 August 2021 at 18:41:32 +0200, Philip Lorenz wrote:
>> Adding this test case was erroneously omitted in
>> 7c722296879906fe093e1e7c4b7537e150d492cd.
>>
>> Signed-off-by: Philip Lorenz <philip@bithub.de>
>> ---
>>   test/test-statx.c  | 20 ++++++++++++++++++++
>>   test/test-statx.sh |  6 ++++++
>>   2 files changed, 26 insertions(+)
>>   create mode 100644 test/test-statx.c
>>   create mode 100755 test/test-statx.sh
>>
>> diff --git a/test/test-statx.c b/test/test-statx.c
>> new file mode 100644
>> index 0000000..06d86af
>> --- /dev/null
>> +++ b/test/test-statx.c
>> @@ -0,0 +1,20 @@
>> +/*
>> + * Test that passing NULL to a parameter marked as nonnull works correctly
>> + * SPDX-License-Identifier: LGPL-2.1-only
>> + *
>> + */
>> +#define _GNU_SOURCE
>> +
>> +#include <sys/stat.h>
>> +#include <unistd.h>
>> +#include <fcntl.h>
>> +
>> +// Passing a null pointer is the test scenario
>> +#pragma GCC diagnostic ignored "-Wnonnull"
>> +
>> +int main(void) {
>> +    if (statx(0, NULL, 0, 0, NULL) != -1) {
>> +        return 1;
>> +    }
>> +    return 0;
>> +}
>> diff --git a/test/test-statx.sh b/test/test-statx.sh
>> new file mode 100755
>> index 0000000..77d0302
>> --- /dev/null
>> +++ b/test/test-statx.sh
>> @@ -0,0 +1,6 @@
>> +#!/bin/bash
>> +#
>> +# SPDX-License-Identifier: LGPL-2.1-only
>> +#
>> +
>> +exec ./test/test-statx
>> -- 
>> 2.32.0
> Applying this patch (along with <169A4FE272BB166C.28384@lists.openembedded.org>)
> makes all the tests pass for me. However, the run of test-statx.sh causes:
>
>   couldn't allocate absolute path for '(null)'.
>
> to be printed.

The test explicitly tests whether a NULL path does not segfault when 
compiled with newer GCC releases (which was fixed in 
7c722296879906fe093e1e7c4b7537e150d492cd). As such the observed error 
message is "intended". It may however make sense to special case NULL 
parameters in pseudo_root_path.

Philip


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-15 12:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 16:41 [pseudo][PATCH] test: Add missing test-statx test case Philip Lorenz
2021-08-11 17:19 ` [OE-core] " Mike Crowe
2021-08-15 12:50   ` Philip Lorenz

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.