This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 73a9c9a69 testing/ostest: accept -ENOENT from work_cancel() for 
unqueued work
73a9c9a69 is described below

commit 73a9c9a69711027a5536f4b51ba5c082f86bf9c9
Author: raiden00pl <[email protected]>
AuthorDate: Thu Sep 17 09:24:45 2026 +0200

    testing/ostest: accept -ENOENT from work_cancel() for unqueued work
    
    Since nuttx commit 5a209a853e ("sched/wqueue: restore -ENOENT from
    work_cancel() for unqueued work") work_cancel() and work_cancel_wq()
    return -ENOENT when the work is not queued. The tester thread queues
    work with zero delay, so the worker may already have consumed it by the
    time it is cancelled and the ASSERT(ret == OK) fires;
    
    Accept -ENOENT there and expect it when cancelling idle work in
    the API validation test.
    
    Signed-off-by: raiden00pl <[email protected]>
---
 testing/ostest/wqueue.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/testing/ostest/wqueue.c b/testing/ostest/wqueue.c
index 73acdef8b..7b83c039a 100644
--- a/testing/ostest/wqueue.c
+++ b/testing/ostest/wqueue.c
@@ -768,10 +768,10 @@ static void api_validation_test(FAR struct kwork_wqueue_s 
*wqueue)
   ASSERT(work_cancel_sync_wq(wqueue, NULL) == -EINVAL);
   ASSERT(work_queue_priority_wq(NULL) == -EINVAL);
 
-  /* Cancelling idle work is intentionally idempotent. */
+  /* Cancelling idle work reports -ENOENT. */
 
-  ASSERT(work_cancel_wq(wqueue, &work) == OK);
-  ASSERT(work_cancel_sync_wq(wqueue, &work) == OK);
+  ASSERT(work_cancel_wq(wqueue, &work) == -ENOENT);
+  ASSERT(work_cancel_sync_wq(wqueue, &work) == -ENOENT);
   ASSERT(work_available(&work));
   printf("wqueue_test: API validation done\n");
 }
@@ -843,7 +843,7 @@ static FAR void *tester(FAR void *arg)
           ret = work_queue_wq(val[1], &work, empty_worker, NULL, 0);
           ASSERT(ret == OK);
           ret = work_cancel_wq(val[1], &work);
-          ASSERT(ret == OK);
+          ASSERT(ret == OK || ret == -ENOENT);
         }
       else
         {
@@ -851,7 +851,7 @@ static FAR void *tester(FAR void *arg)
                            empty_worker, NULL, 0);
           ASSERT(ret == OK);
           ret = work_cancel((int)(uintptr_t)val[0], &work);
-          ASSERT(ret == OK);
+          ASSERT(ret == OK || ret == -ENOENT);
         }
 
       usleep((int)(uintptr_t)val[2]);

Reply via email to