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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e8b90ab
Various corrections
Jimvy Jul 9, 2018
4bf0af0
Some corrections
Jimvy Jul 12, 2018
47b55fd
Adding (hopefully sufficient) .gitignore
Jimvy Jul 13, 2018
ca308e6
Replacing getpagesize() by getconf(_SC_PAGESIZE), which is recommande…
Jimvy Jul 13, 2018
39dbe6e
Adding include guards to prevent multiple inclusions
Jimvy Jul 13, 2018
65736a7
Updating Makefile to include all C source in CTester/
Jimvy Jul 13, 2018
4c2abc5
Prevent SIGFPE from breaking the sandbox and the tests
Jimvy Jul 18, 2018
01ecaba
Applying non-blocking write to pipe_stdout/pipe_stderr
Jimvy Jul 18, 2018
be4ef7a
Removes temporarily the possibility for the student to call exit and …
Jimvy Jul 22, 2018
12258c9
Updating Makefile
Jimvy Jul 25, 2018
43ade11
Fixes unused parameters and shadowed declaration of variable i
Jimvy Jul 25, 2018
482e2f5
First version of DNS-related function wrappers
Jimvy Jul 23, 2018
633320d
Update to DNS functions; it seems to work
Jimvy Jul 23, 2018
29a4a70
Updating Makefile
Jimvy Jul 25, 2018
a19e302
Wrapper functions for socket and related functions
Jimvy Jul 31, 2018
13d65e9
Make CTester compile on CentOS
Jimvy Sep 5, 2018
98c3073
Add select, poll and byte-order functions
Jimvy Sep 6, 2018
3ec71e5
Add delayed chunks to recv
Jimvy Sep 10, 2018
1a321cd
Update run file to allow copying CTester from a external folder
Jimvy Sep 12, 2018
8df0a72
Add fstdout and fstderr to allow tests to bypass the pipes when writi…
Jimvy Sep 12, 2018
f99a7ae
Reorganizing code of read and recv buffering and partial return, for …
Jimvy Sep 17, 2018
60a83ea
Add utility functions for inet and sockets
Jimvy Sep 18, 2018
b279f35
Renaming (well, copying) test_network_dns ro test_network_gai_simple_…
Jimvy Sep 18, 2018
f2c46e8
Fix broken ci
Jimvy Sep 18, 2018
2b7d4d9
Add UDP support to util_sockets and fix a few errors
Jimvy Sep 18, 2018
3685984
Add tests, clean up read_write, and fix a few bugs
Jimvy Sep 18, 2018
027afe5
Add more unit test, a few features and fix bugs detected by these
Jimvy Sep 20, 2018
b0915a3
Remove write_buffer_t, as it is not yet available nor used
Jimvy Sep 20, 2018
df4d54e
Add reinit_network_inet_stats
Jimvy Sep 20, 2018
7e0faab
Add reinit_file_stats
Jimvy Sep 20, 2018
73d4fb7
Rename set_read_buffer and add reinit functions for all stats and all…
Jimvy Sep 21, 2018
6b1c968
Small fix to run file
Jimvy Sep 22, 2018
6fbb737
Fix to run file: by default, do not give a sucess status if score is …
Jimvy Sep 22, 2018
7633453
Remove useless fprintf
Jimvy Sep 22, 2018
43c23a3
Add functions to get the number of bytes read from read_buffer
Jimvy Sep 22, 2018
d34f371
Correcting a few bugs by Valgrind and add a new function to utils-socket
Jimvy Sep 23, 2018
492e131
Merge branch 'master' of github.com:UCL-INGI/CTester
Jimvy Sep 24, 2018
fa5ba4a
Preparing the PR
Jimvy Sep 24, 2018
acc0d8e
Update gitignore
Jimvy Aug 3, 2019
49e4e20
CTester.c: fix missing cleanup of read_write
Jimvy Jul 30, 2019
8508162
Add real tests for DNS
Jimvy Aug 3, 2019
fb12d77
Fix bugs in DNS wrappers
Jimvy Aug 3, 2019
eddc70a
Fix bug in sockets + member name changes for ptr arguments
Jimvy Aug 3, 2019
8fa48fd
Add init, cleanup methods for all mutex wrappers
Jimvy Aug 3, 2019
2d4d4f0
Move fd_is_read_buffered + clean whitespace
Jimvy Aug 3, 2019
080cc6f
Add support for autotest (attempt)
Jimvy Aug 3, 2019
75be8f1
Removing -pedantic as it clashes with RUN's void* and arithmetic
Jimvy Aug 3, 2019
c82b71a
When copying CTester, don't overwrite existing files
Jimvy Aug 3, 2019
7ddb2f6
Add documentation in source files, and license headers. Should be split.
Jimvy Jul 30, 2019
1642bbb
Add Sphinx documentation
Jimvy Aug 3, 2019
ac11fb2
Fix: copy CTester from /CTester alias /course/common/CTester/
Jimvy Aug 21, 2019
6d9d6f2
Add testing of compatibility with LSINF1252
Jimvy Aug 27, 2019
b1b229c
Fix Travis
Jimvy Aug 27, 2019
98ee571
Fix Travis, again
Jimvy Aug 27, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled headers
*.gch
*.pch

# Libraries
*.a
*.lib
*.la
*.lo

# Shared objects
*.so
*.dll
*.so.*
*.dylib

# Executables
*.exe
*.com
*.app

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Vi/Vim
*.vim

# Emacs
*~
\#*\#
.\#*

# VS Code
.vscode/

# vi
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

# macOS/Windows
*.DS_Store
._*
Thumbs.db
*.lnk

# Files specific to this project
student/results.txt
student/tests

14 changes: 13 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
language: c
language: python

python:
- '3.6'

services:
- mongodb
- docker

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.

- docker pull ingi/inginious-c-base
- docker pull ingi/inginious-c-default
- docker pull ingi/inginious-c-cpp
- docker pull ingi/inginious-c-pyjavacpp

script: ci/run_ci
25 changes: 25 additions & 0 deletions ci/courses/LSINF1252
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Assume we're in the correct directory

case $1 in
init)
echo "Git clone"
git clone https://github.com/UCL-INGI/LSINF1252.git
;;
before_autotest)
echo "Before autotest"
# Patch the advanced_queue task's run file
sed -i '/ret = run/i \ \ \ \ subprocess.run(shlex.split("sed -i '"'"'s|\\$(sort \\$(wildcard \\*\\.c))|$(wildcard *.c)|'"'"' student/Makefile"))' advanced_queue/run && echo -e 'Patched advanced_queue'
# cp $2/LSINF1252_advanced_queue_run ./advanced_queue/run
# Patch the three tasks with test submissions to remove the
# "no-use-fifty" option
for i in advanced_queue order_relation_linked_list strcpy;
do
sed -i 's/--no-use-fifty//' $i/run && echo -e 'Patched' $i
done
;;
esac

# That's all

72 changes: 59 additions & 13 deletions ci/run_ci
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash

declare -a tests=("test-simple-success" "test-simple-fail")
cd "$(dirname "$0")"
_term() {
kill -TERM "$child" 2>/dev/null
}

exec_test() {
mkdir env/
Expand All @@ -11,46 +12,91 @@ exec_test() {
pushd env

make
echo "### $1: executing ..."
./tests
echo -e "##### $1: executing ...\n"
./tests &
child=$!
wait "$child"

if [ -f ./results.txt ]; then
cmp --silent results.txt expected_results.txt
if [ $? -eq 0 ]; then
echo '###' $1 ': OK'
echo -e "\n#####" $1 ": OK"
pushd
rm -rf env
return 1
else
echo '###' $1 ': results.txt diverges from the expected output:'
echo -e "\n#####" $1 ": results.txt diverges from the expected output:"
diff results.txt expected_results.txt
fi
else
echo '###' $1 ': CTester did not create a results.txt file'
echo -e "\n#####" $1 ": CTester did not create a results.txt file"
fi

popd
rm -rf env
return 0
}

cd "$(dirname "$0")"

trap _term SIGTERM

if [ "$#" -eq "1" ]; then
# Execute only the specified test
echo -e "##### Executing test" $1
exec_test $1
if [ $? -eq '1' ]; then
echo -e "##### Successful test"
exit 0
else
exit 1
fi
fi

declare -a tests=()
while IFS= read -r -d $'\0'; do
tests+=("$REPLY")
done < <(find . ! -path "." -type d ! -name "courses" -print0)

echo '### Executing tests'
if ((${#tests[@]} == 0)); then
echo -e "No tests found!" >&2
exit 1
fi

echo -e "Found following tests: " ${tests[@]}

echo -e "##### Executing tests"
tests_ok=0

for i in "${tests[@]}"
do
echo '##########' $i
echo -e "\n####################" $i
exec_test $i
if [ $? -eq '1' ]; then
tests_ok=$((tests_ok+1))
fi

echo -e "####################"
done

echo '###' $tests_ok '/' ${#tests[@]} 'tests succeeded'
echo -e "\n####################"
echo -e "### End of tests ###"
echo -e "####################"
echo -e "#####" $tests_ok "/" ${#tests[@]} "tests succeeded"
if ((tests_ok != ${#tests[@]})); then
exit 1
exitval=1
else
exit 0
exitval=0
fi


echo -e "\n####################"
echo -e "## Testing courses #"
echo -e "####################"

./run_course

if (($? == 0)); then
exit $exitval
else
exit 1
fi
Loading