File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -294,4 +294,21 @@ ZTEST(posix_apis, test_named_semaphore)
294
294
295
295
/* All named semaphores should be destroyed here */
296
296
zassert_equal (nsem_get_list_len (), 0 );
297
+
298
+ /* Create a new named sem to be used in the normal semaphore test */
299
+ sem1 = sem_open ("nsem" , O_CREAT , 0 , 0 );
300
+ zassert_equal (nsem_get_list_len (), 1 );
301
+ zassert_equal (nsem_get_ref_count (sem1 ), 1 );
302
+
303
+ /* Run the semaphore test with the created named semaphore */
304
+ semaphore_test (sem1 );
305
+
306
+ /* List length and ref_count shouldn't change after the test */
307
+ zassert_equal (nsem_get_list_len (), 1 );
308
+ zassert_equal (nsem_get_ref_count (sem1 ), 1 );
309
+
310
+ /* Unless it is unlinked and closed */
311
+ sem_unlink ("nsem" );
312
+ sem_close (sem1 );
313
+ zassert_equal (nsem_get_list_len (), 0 );
297
314
}
You can’t perform that action at this time.
0 commit comments