Skip to content

get_next_line moulitest implementation bug #139

@tobyhw

Description

@tobyhw

I am getting different results running moulitest directly and running it through the 42FileChecker. I found that this is because in moulitest, they test
get_next_line(1, NULL) line 10 in 05_test_error_handling.spec.c

However, since 42FileChecker redirects the stdout (1) when it calls moulitest (make "$1" -C "${MOULITEST_DIR}" 1> .mymoulitest 2>&1 in external_repository_moulitest.sh) the read in this test will always fail, so checking the NULL pointer protection does not work.

To test that this is indeed the problem, I changed line 10 in moulitest to run get_next_line(0, NULL) instead and got the desired result, though it was slower because it waited for standard input that never came.

I do not know if there is a way you could manage this from within 42FileChecker without changing moulitest, but if not, it may be worth implementing a test for a NULL pointer in your own tests. In my opinion, the ideal thing would be to test the NULL pointer with an fd that does exist and would otherwise return correctly.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions