Skip to content

Commit

Permalink
Add new integration test for CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarbette committed Dec 18, 2024
1 parent e047aee commit 5006644
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.*
venv
build
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y python3 python3-pip git
RUN apt-get update && apt-get install -y python3 python3-pip git && rm -rf /var/lib/apt/lists/*
COPY . /npf
RUN cd /npf && python3 -m pip install -r /npf/requirements.txt
CMD [""]
22 changes: 16 additions & 6 deletions integration/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@

ret=0

#Function that launches a npf test on click-2022 and compare the expected output
compare() {
test=$1
python=$2
compare_raw() {
test=$2
python=$3
echo "Executing npf test $test..."
$python npf.py click-2022 --force-test --no-graph-time --test integration/$test.npf --quiet-build ${@:3} &> res$test
$python $1 click-2022 --force-test --no-graph-time --test integration/$test.npf --quiet-build ${@:4} &> res$test
if [ $? -ne 0 ] ; then
echo "npf.py returned an error for test $test !"
cat res$test
Expand All @@ -19,12 +18,17 @@ compare() {
echo "$test passed !"
else
echo "Error for $test : expected output does not match !"
echo "Command : $python npf.py click-2022 --force-test --test integration/$test.npf --quiet-build ${@:3}"
echo "Command : $python $1 click-2022 --force-test --test integration/$test.npf --quiet-build ${@:4}"
diff res$test integration/$test.stdout
ret=1
fi
}

#Function that launches a npf test on click-2022 and compare the expected output
compare() {
compare_raw npf.py $@
}

#Function that launch watcher on a npf test with click-2022 and compare the expected output
compare_watcher() {
test=watcher
Expand Down Expand Up @@ -79,6 +83,12 @@ fi


try integration/empty.npf $python
compare_raw npf_compare.py single $python --csv out.csv
diff out.csv integration/single.csv
if [ $? -ne 0 ] ; then
echo "single.csv changed !"
ret=1
fi
compare experimental $python
compare pyexit $python
compare integration-01 $python
Expand Down
4 changes: 4 additions & 0 deletions integration/single.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
index,build,test_index,y_D,run_index
0,Local,0,4.0,0
1,Local,0,4.0,1
2,Local,0,4.0,2
6 changes: 6 additions & 0 deletions integration/single.npf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
%variables
N=2
X=3

%script
echo "RESULT-D 4"
12 changes: 12 additions & 0 deletions integration/single.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Click 2022] Running test single.npf on version 9197a59...
Executing init scripts...
N = 2, X = 3 [run 1/3 for test 1/1]
[0] RESULT-D 4
N = 2, X = 3 [run 2/3 for test 1/1]
[0] RESULT-D 4
N = 2, X = 3 [run 3/3 for test 1/1]
[0] RESULT-D 4
[4.0, 4.0, 4.0]
Generating graphs...
Pandas dataframe written to out.csv
Graph of test written to /npf/compare/single_click-2022-D.pdf

0 comments on commit 5006644

Please sign in to comment.