HomeAbout Us A-Z IndexSearch * Contact Us Register LoginPress Shop

The Open Brand -- Problem Reporting and Interpretations System


Problem Report 1338 Details

Help Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges

This page provides all information on Problem Report 1338.


Report 1338 Actions


    Problem Report Number 1338
    Submitter's Classification Test Suite problem
    State Resolved
    Resolution Test Suite Deficiency (TSD)
    Problem Resolution ID TSD.X.0620
    Raised 1970-01-01 08:00
    Updated 2003-03-13 08:00
    Published 1997-08-05 08:00
    Product Standard Internationalised System Calls and Libraries Extended (UNIX 95)
    Certification Program The Open Brand certification program
    Test Suite VSU version 4.1.1
    Test Identification base/FD_ISSET 1
    Problem Summary TSD4U.00197 This test may fail because the test makes an assumption about the correspondence of fd to a particular fd_bits mask bit.
    Problem Text
    These tests attempt to verify the state of file descriptors represented
    by fd_set following FD_SET or FD_CLR and to verify the correctness of
    FD_ISSET. These tests may improperly fail because they make implicit
    assumptions about the implementation which the standard does not require
    of the implementation, namely:

    1. The standard does not define the mapping between which bit
    is set in the fd_set and the value of the argument "fd". The test
    makes assumptions about this association that are not supported by the
    standard. The only requirement that is specified is that the bit which
    is actually set by the FD_SET macro corresponds to a file designator
    that the select() function recognizes.

    Although there is a one-to-one correspondance between the value of the
    FD_SET argument "fd" and the file designator this argument represents in
    the select function, there is no requirement for the ordering of the
    bits stored in the fd_set.

    2. The test assumes two's complement arithmetic when it
    expects that assigning "-1" to an element of the fd_set will set all of
    the bits of that element. The only valid way to set all the bits of the
    fd_set is to repeatedly call the macro FD_SET with the "fd" argument set
    to every value from 0 to (but not including) NFDS. There is no
    specified way to set all of the bits of a particular element of the
    fd_set.

    3. Workarounds.

    The tests should depend solely on the interface to fd_set
    defined in the standard, namely the macros FD_CLR, FD_ISSET, FD_SET, FD_ZERO,
    and FD_SETSIZE for all operations on the bits in fd_set. Adherence to the
    defined interface will promote portability, which is now impaired.

    Items below are changes needed to remove from the tests
    the the implicit assumption, described above, of an ordering of the
    bits stored in the fd_set.

    i) In the FD_SET and FD_ISSET tests, the following

    /* Set all bits to 0 */
    for (i =0; i< sizeof(myfd_set.fds_bits)/sizeof(long); i++)
    myfd_set.fds_bits[i] = 0;

    should be replaced by the provided FD_ZERO(fd_set *fdset) interface.

    ii) In the FD_CLR and FD_ISSET tests, the following

    /* Set all bits to 1 */
    for (i =0; i< sizeof(myfd_set.fds_bits)/sizeof(long); i++)
    myfd_set.fds_bits[i] = -1;

    assumes two's complement arithmetic, which is not required by the standard,
    to set all bits to one. A loop using the defined interface
    FD_SET should replace it, and properly support portability.

    iii) In FD_ISSET the second of the following lines should be removed

    FD_SET(bitno, &myfd_set);
    myfd_set.fds_bits[i] = k;
    if (FD_ISSET(bitno, &myfd_set) == 0)
    printf("ERROR:FD_ISSET returned 0 for bit %d\n", bitno);


    as it modifies myfd_set without using the defined interface.
    Its purpose should be achieved by use of the defined interface.

    iv) In FD_ISSET the second of the following lines should be removed

    FD_SET(bitno, &myfd_set);
    myfd_set.fds_bits[i] = myfd_set.fds_bits[i] ^ k;
    if (FD_ISSET(bitno, &myfd_set) != 0)
    printf("ERROR:FD_ISSET returned non-0 for bit %d\n", bitno);

    as it modifies myfd_set without using the defined interface.
    Its purpose should be achieved by use of the defined interface.

    v) In FD_CLR

    k = (k *2);
    if (myfd_set.fds_bits[i] != k) {
    printf("ERROR: Cleared bit %d, expected fds_bits element
    %d to be %#lx, is %#lx\n", bitno, i, k, myfd_set.fds_bits[i]);
    }

    should be replaced by use of the defined interface, in a loop(s)
    if necessary.

    vi) In FD_CLR

    if ((myfd_set.fds_bits[k] & j) != 0) {
    printf("ERROR: Bit %d not clear\n", i);
    }
    should be replaced by use of the defined interface,
    in a loop(s) if necessary.

    vii) In FD_SET

    k = (k *2) +1;
    if (myfd_set.fds_bits[i] != k)
    printf("ERROR: Set bit %d, expected fds_bits element %d
    to be %#lx, is %#lx\n", bitno, i, k, myfd_set.fds_bits[i]);

    should be replaced by the defined interface in a loop(s) if necessary.

    viii) In FD_SET

    if ((myfd_set.fds_bits[k] & j) != j)
    printf("ERROR: Bit %d not set\n", i);

    should be replaced by use of the defined interface in a loop(s) if necessay.

    Test Output
    SECTION: CAPIbase

    TEST CASE: FD_ISSET

    TEST PURPOSE #1
    A call to int FD_ISSET(int fd, fd_set *fdset)
    shall return a non-zero value if the bit for
    the file descriptor fd is set in the file
    descriptor set fdset and zero otherwise.
    INFO: Testing the macro version of FD_ISSET
    PREP: Set all bits to 0
    TEST: Set and test all bits
    ERROR: FD_ISSET returned 0 for bit 0
    ERROR: FD_ISSET returned 0 for bit 1
    ERROR: FD_ISSET returned 0 for bit 2
    ERROR: FD_ISSET returned 0 for bit 3
    ERROR: FD_ISSET returned 0 for bit 4
    ERROR: FD_ISSET returned 0 for bit 5
    :
    :
    ERROR: FD_ISSET returned 0 for bit 2044
    ERROR: FD_ISSET returned 0 for bit 2045
    ERROR: FD_ISSET returned 0 for bit 2046
    ERROR: FD_ISSET returned 0 for bit 2047
    PREP: Set all bits to 1
    TEST: Clear and test all bits
    ERROR: FD_ISSET returned non-0 for bit 0
    ERROR: FD_ISSET returned non-0 for bit 1
    ERROR: FD_ISSET returned non-0 for bit 2
    ERROR: FD_ISSET returned non-0 for bit 3
    ERROR: FD_ISSET returned non-0 for bit 4
    ERROR: FD_ISSET returned non-0 for bit 5
    :
    :
    ERROR: FD_ISSET returned non-0 for bit 2044
    ERROR: FD_ISSET returned non-0 for bit 2045
    ERROR: FD_ISSET returned non-0 for bit 2046
    ERROR: FD_ISSET returned non-0 for bit 2047
    1 FAIL

    TEST CASE: FD_CLR

    TEST PURPOSE #1
    A call to void FD_CLR(int fd, fd_set *fdset)
    shall clear the bit for the file descriptor
    fd in the file descriptor set fdset.
    INFO: Testing the macro version of FD_CLR
    PREP: Set all bits to 1
    TEST: Clear and test all bits
    ERROR: Cleared bit 0, expected fds_bits element 0 to be 0xfffffffffffffffe, is 0xfffffffeffffffff
    ERROR: Cleared bit 1, expected fds_bits element 0 to be 0xfffffffffffffffc, is 0xfffffffcffffffff
    ERROR: Cleared bit 2, expected fds_bits element 0 to be 0xfffffffffffffff8, is 0xfffffff8ffffffff
    ERROR: Cleared bit 3, expected fds_bits element 0 to be 0xfffffffffffffff0, is 0xfffffff0ffffffff
    ERROR: Cleared bit 4, expected fds_bits element 0 to be 0xffffffffffffffe0, is 0xffffffe0ffffffff
    ERROR: Cleared bit 5, expected fds_bits element 0 to be 0xffffffffffffffc0, is 0xffffffc0ffffffff
    :
    :
    ERROR: Cleared bit 2042, expected fds_bits element 31 to be 0xf800000000000000, is 0xf8000000
    ERROR: Cleared bit 2043, expected fds_bits element 31 to be 0xf000000000000000, is 0xf0000000
    ERROR: Cleared bit 2044, expected fds_bits element 31 to be 0xe000000000000000, is 0xe0000000
    ERROR: Cleared bit 2045, expected fds_bits element 31 to be 0xc000000000000000, is 0xc0000000
    ERROR: Cleared bit 2046, expected fds_bits element 31 to be 0x8000000000000000, is 0x80000000
    TEST: Bits are still clear
    1 FAIL

    TEST CASE: FD_SET

    TEST PURPOSE #1
    A call to void FD_SET(int fd, fd_set *fdset)
    shall set the bit for the file descriptor
    fd in the file descriptor set fdset.
    INFO: Testing the macro version of FD_SET
    PREP: Set all bits to 0
    TEST: Set and test all bits
    ERROR: Set bit 0, expected fds_bits element 0 to be 0x1, is 0x100000000
    ERROR: Set bit 1, expected fds_bits element 0 to be 0x3, is 0x300000000
    ERROR: Set bit 2, expected fds_bits element 0 to be 0x7, is 0x700000000
    :
    :
    ERROR: Set bit 2042, expected fds_bits element 31 to be 0x7ffffffffffffff, is 0xffffffff07ffffff
    ERROR: Set bit 2043, expected fds_bits element 31 to be 0xfffffffffffffff, is 0xffffffff0fffffff
    ERROR: Set bit 2044, expected fds_bits element 31 to be 0x1fffffffffffffff, is 0xffffffff1fffffff
    ERROR: Set bit 2045, expected fds_bits element 31 to be 0x3fffffffffffffff, is 0xffffffff3fffffff
    ERROR: Set bit 2046, expected fds_bits element 31 to be 0x7fffffffffffffff, is 0xffffffff7fffffff
    TEST: Bits are still set
    1 FAIL

    Review Information

    Review Type TSMA Review
    Start Date null
    Completed null
    Status Complete
    Review Recommendation No Resolution Given
    Review Response
    We agree this is a test suite deficiency in the test
    suite version(s) listed.

    Review Type SA Review
    Start Date null
    Completed null
    Status Complete
    Review Resolution Test Suite Deficiency (TSD)
    Review Conclusion
    This is an agreed Test Suite Deficiency.

    Problem Reporting System Options:

     

    Back   


Contact the Certification Authority