#1464 closed defect (fixed)

psxtests/psxsem01 is broken

Reported by: Ralf Corsepius Owned by: Joel Sherrill
Priority: normal Milestone: 4.10
Component: unspecified Version: 4.10
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

IMO, the psxtests/psxsem01 test is broken:

The only case I found so far, where this shows with visible symptoms is with the h8sxsim BSP:

...
h8300-rtems4.10-gcc -B../../../../../h8sxsim/lib/ -specs bsp_specs -qrtems -DPACKAGE_NAME=\"rtems-c-src-tests-psxtests\" -DPACKAGE_TARNAME=\"rtems-c-src-tests-psxtests\" -DPACKAGE_VERSION=\"4.9.99.0\" -DPACKAGE_STRING=\"rtems-c-src-tests-psxtests\ 4.9.99.0\" -DPACKAGE_BUGREPORT=\"http://www.rtems.org/bugzilla\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DECL_PTHREAD_RWLOCK_UNLOCK=1 -DHAVE_DECL_PTHREAD_ATFORK=1 -DHAVE_DECL_PTHREAD_PTHREAD_ATTR_GETCPUTIME=0 -DHAVE_DECL_PTHREAD_PTHREAD_ATTR_SETCPUTIME=0 -DHAVE_DECL_ADJTIME=0 -DHAVE_DECL_MPROTECT=0 -I. -I../../../../../../../c/src/../../testsuites/psxtests/psxsem01 -I../../../../../../../c/src/../../testsuites/psxtests/include -I../../../../../../../c/src/../../testsuites/psxtests/../support/include -msx -Os -g -Wall -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -MT init.o -MD -MP -MF .deps/init.Tpo -c -o init.o ../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c: In function 'POSIX_Init':
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:174: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:174: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:174: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:174: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:174: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:174: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:174: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:190: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:190: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:190: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:190: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:190: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:190: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:190: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:196: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:196: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:196: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:196: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:196: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:196: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:196: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:221: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:221: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:221: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:221: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:221: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:221: warning: cast from pointer to integer of different size
../../../../../../../c/src/../../testsuites/psxtests/psxsem01/init.c:221: warning: cast from pointer to integer of different size

These warnings all refer to cases fatal_posix_service_status(), related to sem_open(), e.g. this one (near line 174):

n_sem1 = sem_open(Get_Too_Long_Name(), O_CREAT, 0777, 1 );
fatal_posix_service_status(

(int) n_sem1, (int) SEM_FAILED, "sem_open error return status");

The problem here is n_sem1 and SEM_FAILED being pointers of type sem_t*, which cannot be cast to "int" on the h8300/sx.

Further more, the 1st and 2nd arguments to fatal_posix_service_status,
later on (in fatal_posix_service_status_with_level) are used as arguments
in calls to strerror().

This is multiply broken:

  • type-wise (int vs. pointer)
  • strerror's arg is supposed to be an errno

=> IMO, the "sem_open" tests are broken and need to be reworked.

Change History (4)

comment:1 Changed on Oct 31, 2009 at 5:18:35 PM by Joel Sherrill

Resolution: fixed
Status: newclosed

comment:2 Changed on Oct 31, 2009 at 5:19:19 PM by Joel Sherrill

Resolution: fixed
Status: closedreopened

comment:3 Changed on Nov 11, 2009 at 9:21:55 PM by Joel Sherrill

Resolution: fixed
Status: reopenedclosed

I did some changes to every test that calls a routine that can return a pointer set to -1. I added a new test macro to handle this POSIX pattern and avoid casts.

comment:4 Changed on Oct 10, 2017 at 6:46:55 AM by Sebastian Huber

Component: testingunspecified
Note: See TracTickets for help on using tickets.