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

Add socket-related functions and wrappers, and a few other fixes. #2

Open
wants to merge 54 commits into
base: master
Choose a base branch
from

Conversation

Jimvy
Copy link
Collaborator

@Jimvy Jimvy commented Sep 24, 2018

This contains a lot of fixes and additions to CTester:

  • wrappers for socket-related functions, and associated unit tests;
  • utility functions related to sockets;
  • various corrections to the existing code;
  • splitting the run file to have the possibility to include CTester in a directory common to all other tasks;
  • and probably much more.

Jimvy added 30 commits July 9, 2018 17:34
(Including wrap_getpid.c which was absent)
Minor changes to student_code.h
The original code only made the reading end of the pipe non-blocking,
as it needs to empty the pipe after the sandbox.
But, if the student's program actually writes a lot on the writing end
of the pipe, the pipe will block and cause the program to timeout.
It is better to actually report this error (too much output)
rather than waiting for the task to end.
In both cases, the output will be truncated and it will not pass the tests,
as we may expect the problem author to not require the student to output
more than 65536 bytes or so of data on stdout or on stderr.
…bypass the tests.

Also, makes sure to have a less undefined behaviour if the student
actually calls exit: it will predictably raise a SIGSEGV instead of
randomly not crashing instantly.
Functions: socket, bind, connect, accept, listen, recv (and al),
send (and al).
Currently only supports statistics
Also included: Some unit tests
Not well-tested, however
- Remove write-related functions from read_write (currently not needed).
- Add to run_ci the possibility of executing a single test.
- A few corrections in read_write (time.h, NULL, const etc).
- Allow exit to be called normally when the sandbox is not running.
Among these were incoherence between nanoseconds, microseconds and
milliseconds, bad type for intervals, and something else.
Functionnalities added include the possibility to create a read_buffer_t
from the tables of offsets and intervals, when the data is contigous.
The function allows to connect a UDP socket to a remote client. Also, a
confusion has been fixed
Needs to be applied after read_write changes
- monitored.gai_strerror
- memory leak when reset
- missing implementations of setters of fai_report and check_fai
- Fix simple_getaddrinfo so that it is more compliant to the true one
- Add reset for all alternative methods
@Jimvy
Copy link
Collaborator Author

Jimvy commented Aug 3, 2019

Sooo...

  • CNP3 exercises work perfectly as before (safe for an error in the grading code of the TCP exercise)
  • The task "strcpy" on LSINF1252 fails to compile due to errors in the test submissions that are caught by the new flags (-Wextra) ; submission 1
  • The task "advanced_queue" fails to compile due to a redefinition of the "stats" variable ; submissions 4, 5, 6, 9, 10, 11, 12, 13, 15
  • The task "order_relation_linked_list" fails too, for an unknown reason ; submission 3.
    Aside from these, everything kind of works in local. A lot of bugs were fixed. Documentation was FINELY added.
    Future todos:
  • Add more tests with real world task, like those on CNP3 - and add support in run_ci to recursively test the subfolders, and to execute a pre-test script
  • Investigate the limitations that are in doc/limitations.rst

@Jimvy
Copy link
Collaborator Author

Jimvy commented Aug 27, 2019

FINALY.
The three tasks failed for the following reasons:

  • Addition of $(sort) to the SRC variable in the Makefile. The first item of the list changed from tests.c to student_code.c , and it causes problems with cppcheck, whose submissions are generally based on the mostly error-free tests.c
  • The default option --no-use-fifty, whereas all tasks used a 50% threshold.
  • Some compiler flags that were too aggressive: -Wextra and -Wshadow.
    So, a temporary solution is to patch the files used for these 3 exercises.

Note that in the process of adding LSINF1252, it became possible to test for multiple subdirectories in ci/, but there may be some uncovered bugs.

@mpiraux
Copy link
Collaborator

mpiraux commented Sep 10, 2019

Great! I don't know much about CTester itself, so I can't review every line of code you wrote, but the tests output give some confidence on the fact that nothing broke.

I think having the CI testing other courses from this repository is not the best option though. Don't get me wrong, having a CI testing a course is nice but it should not be CTester's CI. I think this repository should only contain self-contained tests, such as the ones you also added.
Could you move the courses testing part to the tested course repositories themselves ? Or is there something that I have missed that prevents you from doing so ?


before_install:
- sudo apt-get install libcunit1 libcunit1-dev
- pip3 install git+https://github.com/Maxmawt/INGInious # Until UCL-INGI/INGInious has fixed his part ;-)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed ? Could you refer to a specific issue we should track on the INGInious repository ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was #414, but I don't know if it has been fixed since then. I'll check.

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

Successfully merging this pull request may close these issues.

2 participants