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

get_next_line moulitest implementation bug #139

Open
tobyhw opened this issue Mar 7, 2019 · 1 comment
Open

get_next_line moulitest implementation bug #139

tobyhw opened this issue Mar 7, 2019 · 1 comment

Comments

@tobyhw
Copy link

tobyhw commented Mar 7, 2019

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.

@jgigault
Copy link
Owner

Hello @tobyhw

Sorry for my (very) late answer.

Could you provide me a working example of the observed behavior?
I am not in capacity to reproduce a differing behavior between moulitest "standalone" and moulitest "within 42FC"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants