Commit Graph

131 Commits

Author SHA1 Message Date
TaiJuWu
9f2f86441d Fix sigprocmask
1. SIGSTOP and SIGKILL should not be used as test. In g_some_signals,
SIGKILL is used.

2. The SIGSTOP and SIGKILL flags of current task are set so we need to
delete them.
2023-09-16 00:08:34 +03:00
chao an
6923c9cf57 testing: fix visual studio Compiler Error C2057
expected constant expression
The context requires a constant expression, an expression whose value is known at compile time.
The compiler must know the size of a type at compile time in order to allocate space for an instance of that type.

Reference:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2057?view=msvc-170

Signed-off-by: chao an anchao@xiaomi.com
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 15:44:09 +08:00
Zhe Weng
87838bb62c ostest/wqueue: Check return value for pthread ops.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-22 13:55:03 +08:00
Xiang Xiao
6716f15d7b testing: Check CONFIG_TLS_NELEM is defined before using it
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-21 15:08:17 +03:00
hujun5
79a111fc1a ostest/mutex: mut need to be destroyed
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-08-09 15:07:25 +08:00
Petro Karashchenko
3648c0cc5c testing/ostest: call up_idle() only in case of CONFIG_SIM_WALLTIME_SLEEP=y
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-07 18:58:46 -07:00
Petro Karashchenko
6acf345296 testing/ostest: add test case for task priority change with locked scheduler
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-07 18:58:46 -07:00
Petro Karashchenko
e30a0602a0 testing/ostest: add missing section comments
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-07 18:58:46 -07:00
guanyi
f50d2cdbe3 fix ostest sigprocmask testcase
problem: ostest may fail at procmask test, because signals:sigkill/sigstop should not be added in signal mask
solution: skip checking whether sigkill/sigstop are in signal mask

Signed-off-by: guanyi <guanyi@xiaomi.com>
2023-08-01 21:02:52 +09:00
hujun5
13d3b3d26c ostest/rmutex: mutex need to be destroyed
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-07-26 08:33:26 -07:00
Xiang Xiao
d46dce5819 testing/ostest: Remove the unnecessary defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-25 09:51:09 +08:00
Xiang Xiao
ff276e422f ostest: Skip test_dev_null when CONFIG_DEV_NULL isn't enabled
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-17 16:28:02 +09:00
chao an
b18cf9aab3 testing/ostest: fix Compiler Warning (level 1) C4716: 'function' must return a value
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4716?view=msvc-170
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-14 01:28:25 +08:00
chao an
4d79a5cbaf add initial cmake build system
Co-authored-by: Daniel Agar <daniel@agar.ca>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:52:02 +08:00
Gregory Nutt
6d9259f334 Add small test of pthread_exit()/pthread_self() on main thread. 2023-06-29 13:53:02 +08:00
Xiang Xiao
e89409cfe6 Remove the unnecessary cast from pid_t to int
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-19 09:05:54 +02:00
yanghuatao
cb179e4ed2 testing/ostest: adjust PTHREAD_CLEANUP_STACKSIZE with nuttx project
in project nuttx "remove PTHREAD_CLEANUP, and use PTHREAD_CLEANUP_STACKSIZE to enable or disable interfaces pthread_cleanup_push() and pthread_cleanup_pop()", project apps also needes adjust code.

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-06-14 08:49:13 +02:00
hujun5
97a38b2b1f ostest/cond_test: cond and mutex need to be destroyed
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-23 13:11:07 +08:00
Xiang Xiao
7032c72f2f Indent the define statement by two spaces
follow the code style convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-21 07:39:53 +03:00
hujun5
db767b6f45 ostest/sighand_test: sem need to be destroyed
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-20 12:42:35 +08:00
hujun5
70a4010635 ostest: sem need to be destroyed
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-16 11:59:08 +08:00
hujun5
dd20ae28cb ostest: rwlock need to be destroy
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-12 15:32:18 -03:00
hujun5
02efb15b57 ostest:fix signal test fail
If the same signal is quickly repeated multiple times, the signal may be ignored.
In SMP since we cannot control thread scheduling to ensure timely signal processing,
it is best to use semaphores to wait for signal processing to complete, which can also shorten the ostest time

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-06 23:37:07 +03:00
simbit18
bfd4cbc743 apps/testing/ostest/roundrobin.c: Fix nxstyle errors
error: Long line found
2023-04-29 14:54:40 +08:00
hujun5
5b2a89e174 ostest: fix smp ostest fail
In SMP we need improve thread waiting strategy

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-04-24 09:55:54 +02:00
hujun5
f0f98c3d73 ostest: fix smp ostest fail
In SMP we need improve thread waiting strategy

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-04-24 09:55:54 +02:00
Petro Karashchenko
4159fa197b testing/ostest: make sure that pthread_rwlock timeout test is executed properly
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-04-17 15:54:32 +02:00
Petro Karashchenko
2655f80dd7 testing/ostest: fix tasks priority assignment in nested signal test
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-04-17 15:54:32 +02:00
Xiang Xiao
417b87a0a0 testing/ostest: Remove the unreal used SIG_WAITCANCEL
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-05 03:38:24 -07:00
Xiang Xiao
3ac86cc6f1 testing/ostest: Define the private used signal to SIGRTMIN
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-05 03:38:24 -07:00
Fotis Panagiotopoulos
b93aa0cb8d ostest: Fixed use of uninitialized variable. 2023-04-05 03:57:00 +03:00
Gustavo Henrique Nihei
efb4e0bc91 Add another batch of missing headers throughout the repository
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-03-28 14:54:16 -03:00
Gregory Nutt
a1bca5070c Changes to apps needed by nutts PR 8885
ostest contains some logic that depends on internal implementation of signal sets and ostest must be updated to match those changes.

There is no particular impact from this PR.  This PR is the result of impact from nuttx 8885.

Tested with nuttx 8885
2023-03-27 16:58:52 +03:00
Zhe Weng
412505d286 ostest: Introduce basic work queue test
The test consists of two parts:
- A tester that tries to trigger wrong states of work queue
- A verifier that checks whether the wqueue is still working properly

The tester is trying to queue and cancel work several times with
priority lower/same/higher than the work queue.

Most wrong cases are likely to happen with high priority like:
- If `cancel` never decreases semcount, the count may keep growing
  and finally overflow
- If `cancel` is decreasing semcount too much, the `work_thread` may
  be waken up less times than expected

The lower/same priority testers are just added for covering other
unexpected situations.

The verifier is trying to queue some works and check they are called as
expected:
- Frist queue a 'sleep' worker, to let a work queue thread be in busy
  status and not waiting on sem, while other work queue thread(s) (if
  any) still waiting for sem. If sem is in wrong state, it may cause
  wrong behavior in either thread waiting/not waiting on the sem.
- Then queue a few count works, if the work queue(s) are still working
  properly, these works should finally be all called once.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-03-22 12:56:01 +02:00
zhangyuan21
4454c8d02f apps: remove unnecessary sem_setprotocol code
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-03-17 11:58:03 -03:00
zhangyuan21
922f9932a6 apps: add <assert.h> header file
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-03-16 12:00:28 +01:00
Gustavo Henrique Nihei
f500c64962 Include missing headers throughout the repository
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-03-07 09:58:13 +08:00
Xiang Xiao
a29d9ea9da fsutils/examples: Include unistd.h explicitly
to get the prototypes or macros are defined in it

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-05 08:46:59 +02:00
Gustavo Henrique Nihei
b0da60e498 apps: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-02 00:35:14 +02:00
Masayuki Ishikawa
bb8b5493e0 testing: ostest: Show errno in message queue test
Summary:
- This commit shows errno in message queue test

Impact:
- None

Testing:
- Tested with esp32-devkitc:smp on QEMU-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-01-31 22:10:59 +08:00
ligd
7f11c91054 ostest: remove printf & sem_wait in sigaction
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-12-21 13:38:18 +09:00
qinwei1
c86509be4c apps: getpid should return process id not thread id
Summary:
   following the change in the nuttx kernel, implement the right semantics:
1. getpid should return the main thread id
2. gettid should return the current thread id

Refer:
 https://github.com/apache/incubator-nuttx/issues/2499
 https://github.com/apache/incubator-nuttx/pull/2518

Nuttx Kernel PR:
 https://github.com/apache/incubator-nuttx/pull/7597

update apps code

Testing PASSED with qemu( 32/64 )

Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2022-11-17 17:58:45 +08:00
zhangyuan21
3dabc24635 ostest: reset g_restartstep when test case restart
The g_restartstep value is not initialized when ostest repeated.
2022-11-16 00:07:38 +08:00
anjiahao
65668b33d9 ostest:add sem protocl to priority inheritance
ostest testcase use sem as lock
need set protocl
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 16:23:42 +09:00
Xiang Xiao
6f01a3b3d4 testing/ostest: Remove the code which reference CONFIG_SEM_NNESTPRIO
since CONFIG_SEM_NNESTPRIO is removed by:
https://github.com/apache/incubator-nuttx/pull/6318

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-21 09:18:26 +02:00
Masayuki Ishikawa
ee7b47ba4e testing: ostest: Fix task_restart test
Summary:
- This commit fixes the task_restart test for the 2nd time execution

Impact:
- None

Testing:
- sim:ostest

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-10-21 01:34:15 +08:00
Xiang Xiao
b659f0fbdf Remove the unnecessary cast for main_t, NULL and argv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 18:40:23 +02:00
Xiang Xiao
893387b2c5 Fix the minor style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 19:07:16 +02:00
Masayuki Ishikawa
97440889ac testing: ostest: Add ASSERT in case of errors
Summary:
- This commit adds ASSERT in case of errors to stop the
  execution of ostest
- Also, add some 'ERROR' messages

Impact:
- None

Testing:
- Run ostest with several configs

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-10-16 13:24:50 +08:00
zhangyuan21
7fcba8a119 ostest: add semaphore wait case for task restart 2022-10-11 15:29:45 +08:00