[PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test

Taylor Simpson posted 1 patch 1 week ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1610476384-13760-1-git-send-email-tsimpson@quicinc.com
tests/tcg/multiarch/testthread.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

[PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test

Posted by Taylor Simpson 1 week ago
---
 tests/tcg/multiarch/testthread.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tests/tcg/multiarch/testthread.c b/tests/tcg/multiarch/testthread.c
index 810ba5d..b30b4b5 100644
--- a/tests/tcg/multiarch/testthread.c
+++ b/tests/tcg/multiarch/testthread.c
@@ -50,8 +50,29 @@ void test_pthread(void)
     printf("End of pthread test.\n");
 }
 
+void *thread3_func(void *arg)
+{
+    usleep(3 * 1000);
+    return 0;
+}
+
+void test_cancel(void)
+{
+    pthread_t thread;
+    void *res;
+
+    pthread_create(&thread, 0, thread3_func, NULL);
+    pthread_cancel(thread);
+    pthread_join(thread, &res);
+    if (res != PTHREAD_CANCELED) {
+        puts("ERROR: thread not cancelled");
+        exit(EXIT_FAILURE);
+    }
+}
+
 int main(int argc, char **argv)
 {
     test_pthread();
+    test_cancel();
     return 0;
 }
-- 
2.7.4

Re: [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test

Posted by Alex Bennée 1 week ago
Taylor Simpson <tsimpson@quicinc.com> writes:

> ---
>  tests/tcg/multiarch/testthread.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/tests/tcg/multiarch/testthread.c b/tests/tcg/multiarch/testthread.c
> index 810ba5d..b30b4b5 100644
> --- a/tests/tcg/multiarch/testthread.c
> +++ b/tests/tcg/multiarch/testthread.c
> @@ -50,8 +50,29 @@ void test_pthread(void)
>      printf("End of pthread test.\n");
>  }
>  
> +void *thread3_func(void *arg)
> +{
> +    usleep(3 * 1000);
> +    return 0;
> +}
> +
> +void test_cancel(void)
> +{
> +    pthread_t thread;
> +    void *res;
> +
> +    pthread_create(&thread, 0, thread3_func, NULL);
> +    pthread_cancel(thread);
> +    pthread_join(thread, &res);
> +    if (res != PTHREAD_CANCELED) {
> +        puts("ERROR: thread not cancelled");
> +        exit(EXIT_FAILURE);
> +    }

Aside from the signoff line which I need could you add something like:

      printf("End of pthread cancel test.\n");

just to aid debugging.

Thanks,


> +}
> +
>  int main(int argc, char **argv)
>  {
>      test_pthread();
> +    test_cancel();
>      return 0;
>  }


-- 
Alex Bennée

Re: [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test

Posted by no-reply@patchew.org 1 week ago
Patchew URL: https://patchew.org/QEMU/1610476384-13760-1-git-send-email-tsimpson@quicinc.com/



Hi,

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

Type: series
Message-id: 1610476384-13760-1-git-send-email-tsimpson@quicinc.com
Subject: [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test

=== 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
 * [new tag]         patchew/1610476384-13760-1-git-send-email-tsimpson@quicinc.com -> patchew/1610476384-13760-1-git-send-email-tsimpson@quicinc.com
Switched to a new branch 'test'
d62cd1e tests/tcg/multiarch/testthread.c: Add pthread_cancel test

=== OUTPUT BEGIN ===
ERROR: Missing Signed-off-by: line(s)

total: 1 errors, 0 warnings, 29 lines checked

Commit d62cd1e79a06 (tests/tcg/multiarch/testthread.c: Add pthread_cancel test) 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/1610476384-13760-1-git-send-email-tsimpson@quicinc.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com