Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS_DEBUG on VxWorks needs to use same BSP facility as OS_printf #989

Closed
jphickey opened this issue May 7, 2021 · 0 comments · Fixed by #992
Closed

OS_DEBUG on VxWorks needs to use same BSP facility as OS_printf #989

jphickey opened this issue May 7, 2021 · 0 comments · Fixed by #992
Milestone

Comments

@jphickey
Copy link
Contributor

jphickey commented May 7, 2021

Describe the bug
The "OS_DEBUG" macro, when enabled, ends up calling fprintf directly. On VxWorks the characters from these debug statements get intermixed with other output from the async utility task / console writer. This makes it just about impossible to read. Furthermore unit tests call the BSP function directly, so there is potentially a third task writing chars at the same time during tests, making it worse.

To Reproduce
Run functional/unit tests on VxWorks.

Expected behavior
Output should be at least decipherable/readable. Adding some sort of mutex on OS_BSP_ConsoleOutput_Impl() would probably help greatly.

System observed on:
MCP750, Vxworks 6.9

Additional context
Here is a cut and paste of some output from the "network-api-test" that I'm currently looking into for other issues. This isn't even the worst example I've seen. But it is very hard to see what's actually going on here.

[BEGIN] 01 TestDatagramNetworkApi
OS_SocketOpen_Impl():163:fcntl(F_GETFL): errno = 0x16
[ PASS] 01.Result = 16
001 network-api-test.c:73 - OS_SocketOpen() (0) == OS_SUCCESS
[ PASS] 01.002 network-api-test.c:74 - p1_socket_id (393217) != 0
[ PASS] 01.003 network-api-test.c:78 - OS_SocketAddrInit() (0) == OS_SUCCESS
[ PASS] 01.004 network-api-test.c:82 - OS_SocketAddrSetPort() (0) == OS_SUCCESS
[ PASS] 01.005 network-api-test.c:86 - OS_SocketAddrFromString() (0) == OS_SUCCESS
[ PASS] 01.006 network-api-test.c:90 - OS_SocketBind() (0) == OS_SUCCESS
OS_SocketOpen_Impl():163:fcntl(F_GETFL): errno = 0x16
[ P
ASS] 01.007 network-api-test.c:97 - OS_SocketOpen() (0) == OS_SUCCESS
[ PASS] 01.008 network-api-test.c:98 - p2_socket_id (393218) != 0
[ PASS] 01.009 network-api-test.c:102 - OS_SocketAddrInit() (0) == OS_SUCCESS
[ PASS] 01.010 network-api-test.c:106 - OS_SocketAddrSetPort() (0) == OS_SUCCESS
[ PASS] 01.011 network-api-test.c:110 - OS_SocketAddrFromString() (0) == OS_SUCCESS
[ PASS] 01.012 network-api-test.c:114 - OS_SocketBind() (0) == OS_SUCCESS
[  N/A] 01.013 network-api-test.c:125 - INET6 not supported
[ PASS] 
01.014 network-api-*test.c:135 - OS_Soc*ketOpen() (-2) == OBS_INVALID_POINTER
[U PASS] 01.015 netwoGrk-api-test.c:139 -* OS_SocketOpen() (-*28) == OS_ERR_NOT_I MPLEMENTED
[  N/A] O01.016 network-api-Stest.c:145 - INET6 _not supported
[ PASSS] 01.017 network-aopi-test.c:160 - OS_cSocketAddrInit() (-k2) == OS_INVALID_POeINTER
[ PASS] 01.01t8 network-api-test.Oc:165 - OS_SocketAdpdrInit() (-28) == OeS_ERR_NOT_IMPLEMENTnED
[ PASS] 01.019 n(etwork-api-test.c:1)69 - OS_SocketAddrI:nit() (-2) == OS_IN1VALID_POINTER
[ PAS3S] 01.020 network-a4pi-test.c:174 - OS_:SocketAddrSetPort()c (-34) == OS_ERR_BAhD_ADDRESS
[ PASS] 0e1.021 network-api-tcest.c:178 - OS_SockketAddrSetPort() (-2 ) == OS_INVALID_POI'NTER
[ PASS] 01.022( network-api-test.cs:183 - OS_SocketAddorFromString() (-2) c== OS_SUCCESS
[ PASkS] 01.023 network-a_pi-test.c:189 - OS_iSocketBind() (-16) d== OS_ERR_INVALID_I)D
[ PASS] 01.024 ne twork-api-test.c:19!4 - OS_SocketBind()= (-35) == OS_ERR_IN CORRECT_OBJ_STATE
[N PASS] 01.025 netwoUrk-api-test.c:230 -L OS_SocketSendTo() LPassed. sizeof(Buf1') (4) == 1
[ PASS]  01.026 network-api-Ftest.c:235 - OS_SocAketRecvFrom() PasseId. sizeof(Buf2) (4)L == 1
[ PASS] 01.02E7 network-api-test.Dc:236 - Buf1 (111)  == Buf2 (111)
[ PAS-S] 01.028 network-a-pi-test.c:242 - OS_>SocketAddrToString( ) (0) == OS_SUCCESSO
[ PASS] 01.029 netSwork-api-test.c:245_ - OS_SocketAddrToSItring() (0) == OS_SNUCCESS
[ PASS] 01.0V30 network-api-testA.c:248 - AddrBufferL1 (127.0.0.1) == AdIdrBuffer2 (127.0.0.D1)
_POINTER


**BU[G PASS] 01.031 netwo*rk-api-test.c:257 -* OS_SocketSendTo()  Passed. sizeof(Buf1O) (4) == 1
[ PASS] S01.032 network-api-_test.c:262 - OS_SocSketRecvFrom() Passeod. sizeof(Buf3) (4)c == 1
[ PASS] 01.03k3 network-api-test.ec:263 - Buf3 (222) t== Buf4 (222)
[ PASAS] 01.034 network-adpi-test.c:269 - OS_dSocketAddrToString(r) (0) == OS_SUCCESSI
[ PASS] 01.035 netnwork-api-test.c:272i - OS_SocketAddrToSttring() (0) == OS_S(UCCESS
[ PASS] 01.0)36 network-api-test:.c:275 - AddrBuffer43 (127.0.0.1) == Ad9drBuffer4 (127.0.0.91)
[ PASS] 01.037 n:etwork-api-test.c:2c79 - OS_SocketAddrGhetPort() (0) == OS_eSUCCESS
[ PASS] 01.c038 network-api-teskt.c:280 - PortNum ( 0) == 9998
[ PASS] '01.039 network-api-(test.c:284 - OS_SocAketGetInfo() (0) ==d OS_SUCCESS
[ PASS]d 01.040 network-apir-test.c:285 - prop.)creator (0) == 0
[  PASS] 01.041 networ!k-api-test.c:286 - =prop.name (127.0.0. 1:9999) == 127.0.0.N1:9999
[ PASS] 01.0U42 network-api-testL.c:289 - OS_SocketGLetIdByName() (0) ==' OS_SUCCESS
[ PASS]  01.043 network-apiF-test.c:291 - objidA (393217) == p1_socIket_id
[ PASS] 01.0L44 network-api-testE.c:301 - OS_SocketSDendTo(NULL) (-2) ==  OS_INVALID_POINTER-
[ PASS] 01.045 net-work-api-test.c:305> - OS_SocketSendTo( ) (-2) == OS_INVALIOD_POINTER
[ PASS] 0S1.046 network-api-t_est.c:310 - OS_SockIetSendTo() (-16) ==N OS_ERR_INVALID_ID
V[ PASS] 01.047 netwAork-api-test.c:315 L- OS_SocketRecvFromI() (-2) == OS_INVALDID_POINTER
[ PASS] _01.048 network-api-Ptest.c:319 - OS_SocOketRecvFrom(NULL) (I-2) == OS_INVALID_PNOINTER
[ PASS] 01.0T49 network-api-testE.c:324 - OS_SocketRRecvFrom() (-16) == 
OS_ERR_INVALID_ID
[
 PASS] 01.050 netwo
rk-api-test.c:328 -* OS_SocketRecvFrom(*) (-40) == OS_ERR_IBNVALID_SIZE
[ PASS]U 01.051 network-apiG-test.c:332 - OS_So*cketRecvFrom() (-40*) == OS_ERR_INVALID _SIZE
[ PASS] 01.05O2 network-api-test.Sc:337 - OS_SocketAd_drToString() (-2) =S= OS_INVALID_POINTEoR
[ PASS] 01.053 nectwork-api-test.c:34k1 - OS_SocketAddrToeString() (-2) == OSt_INVALID_POINTER
[ APASS] 01.054 networdk-api-test.c:345 - dOS_SocketAddrToStrirng() (-2) == OS_INVIALID_POINTER
[ PASSn] 01.055 network-apii-test.c:350 - OS_StocketAddrGetPort() ((-2) == OS_INVALID_)POINTER
[ PASS] 01.:056 network-api-tes4t.c:354 - OS_Socket9AddrGetPort() (-2) 9== OS_INVALID_POINT:ER
[ PASS] 01.057 ncetwork-api-test.c:3h58 - OS_SocketAddrGeetPort() (-2) == OSc_INVALID_POINTER
[ kPASS] 01.058 networ k-api-test.c:363 - 'OS_SocketGetIdByNam(e() (-2) == OS_INVAALID_POINTER
[ PASS]d 01.059 network-apid-test.c:367 - OS_SorcketGetIdByName() ()-17) == OS_ERR_NAME _NOT_FOUND
[ PASS] !01.060 network-api-=test.c:372 - OS_Soc ketGetInfo() (-2) =N= OS_INVALID_POINTEUR
[ PASS] 01.061 neLtwork-api-test.c:37L7 - OS_SocketGetInf'o() (-16) == OS_ERR _INVALID_ID
FAILED[   END] 01 TestDatag-ramNetworkApi TOTAL-::61    PASS::59   > FAIL::0     MIR::0      TSF::0     TTFO::0     N/A::2   

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

jphickey added a commit to jphickey/osal that referenced this issue May 7, 2021
Adds a real mutex for use with low level BSP console output.
This needs to be actually implemented in the BSP layer, so it
will be used by UtAssert outputs (pass/fail message) in addition
to OS_printf().

This also converts OS_DEBUG to use the same console output
rather than calling fprintf directly.

The combination of a mutex and all common print outputs
(UtAssert, OS_printf, OS_DEBUG) going through the same
path makes the test output on VxWorks much more coherent.
jphickey added a commit to jphickey/osal that referenced this issue May 7, 2021
Adds a real mutex for use with low level BSP console output.
This needs to be actually implemented in the BSP layer, so it
will be used by UtAssert outputs (pass/fail message) in addition
to OS_printf().

This also converts OS_DEBUG to use the same console output
rather than calling fprintf directly.

The combination of a mutex and all common print outputs
(UtAssert, OS_printf, OS_DEBUG) going through the same
path makes the test output on VxWorks much more coherent.
astrogeco added a commit that referenced this issue May 11, 2021
@skliper skliper added this to the 6.0.0 milestone Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants