All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test
@ 2021-01-12 18:33 Taylor Simpson
  2021-01-12 18:54 ` no-reply
  2021-01-12 20:22 ` Alex Bennée
  0 siblings, 2 replies; 3+ messages in thread
From: Taylor Simpson @ 2021-01-12 18:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: tsimpson, alex.bennee

---
 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


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

* Re: [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test
  2021-01-12 18:33 [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test Taylor Simpson
@ 2021-01-12 18:54 ` no-reply
  2021-01-12 20:22 ` Alex Bennée
  1 sibling, 0 replies; 3+ messages in thread
From: no-reply @ 2021-01-12 18:54 UTC (permalink / raw)
  To: tsimpson; +Cc: tsimpson, alex.bennee, qemu-devel

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

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

* Re: [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test
  2021-01-12 18:33 [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test Taylor Simpson
  2021-01-12 18:54 ` no-reply
@ 2021-01-12 20:22 ` Alex Bennée
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Bennée @ 2021-01-12 20:22 UTC (permalink / raw)
  To: Taylor Simpson; +Cc: qemu-devel


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


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

end of thread, other threads:[~2021-01-12 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-12 18:33 [PATCH] tests/tcg/multiarch/testthread.c: Add pthread_cancel test Taylor Simpson
2021-01-12 18:54 ` no-reply
2021-01-12 20:22 ` Alex Bennée

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.