-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathftests.sh
More file actions
executable file
·53 lines (47 loc) · 1.23 KB
/
ftests.sh
File metadata and controls
executable file
·53 lines (47 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
##
## EPITECH PROJECT, 2023
## coconut
## File description:
## functional tests
##
REPORT_FILE="coding-style-reports.log"
EXPECT_FILE="expected-reports.log"
if [ "$1" = "--local" ]; then
echo "Building locally"
cmake -Bbuild
cmake --build build -j
echo "Installing locally"
sudo cmake --install build
else
echo "Building docker image"
IMAGE=$(docker build -q .)
echo "Built image: $IMAGE"
fi
error=0
for expfile in ./tests/*.t/"$EXPECT_FILE"; do
dir=$(dirname "$expfile")
printf "\033[33mRunning test $dir\033[0m\n"
dirname=$(realpath "$dir")
if [ "$1" = "--local" ]; then
script=$(realpath "./check.sh")
pushd "$dirname" > /dev/null
rm -f "$REPORT_FILE"
"$script" . .
sed -i -e 's#^'"$dirname"'/##' "$REPORT_FILE"
make fclean > /dev/null
popd > /dev/null
else
docker run --rm -i \
-v "$dirname":/mnt/delivery \
-v "$dirname":/mnt/reports \
"$IMAGE" /mnt/delivery /mnt/reports
fi
if diff "$dir/$EXPECT_FILE" "$dir/$REPORT_FILE"; then
printf "\033[32mTest $dir: OK\033[0m\n"
else
printf "\033[31mTest $dir: KO\033[0m\n"
error=1
fi
done
exit $error