Skip to content

Commit 8ee2bac

Browse files
committed
Add script to execute testcases, create /aster as working directory
1 parent c9085fd commit 8ee2bac

4 files changed

Lines changed: 110 additions & 4 deletions

File tree

Dockerfile.mpi.default

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ RUN apt-get clean && \
105105
rm -rf /var/lib/apt/lists/* /var/tmp/* && \
106106
rm -rf /data
107107

108+
ADD run_testcases /usr/local/bin/
109+
108110
# create aster user
109-
RUN useradd -ms /bin/bash aster
111+
RUN useradd -ms /bin/bash aster && \
112+
mkdir /aster && \
113+
chown aster:aster /aster
110114
USER aster
111115
WORKDIR /home/aster

Dockerfile.seq.default

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ RUN apt-get clean && \
5252
rm -rf /var/lib/apt/lists/* /var/tmp/* && \
5353
rm -rf /data
5454

55+
ADD run_testcases /usr/local/bin/
56+
5557
# create aster user
56-
RUN useradd -ms /bin/bash aster
58+
RUN useradd -ms /bin/bash aster && \
59+
mkdir /aster && \
60+
chown aster:aster /aster
5761
USER aster
5862
WORKDIR /home/aster

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,19 @@ by name (`P version unstable`).
7979
Now, run a code_aster container using local files:
8080

8181
``` bash
82-
docker run --rm --volume $(pwd)/workdir:/study code_aster_seq:default \
83-
as_run --nodebug_stderr /study/export
82+
docker run --rm --volume $(pwd)/workdir:/aster code_aster_seq:default \
83+
as_run --nodebug_stderr /aster/export
84+
```
85+
86+
### Validation
87+
88+
*Some prerequisites are not yet available within the container
89+
(miss3d, ecrevisse, etc.). So, all the tests that are using these tools
90+
are currently in failure.*
91+
92+
The `--test` argument allows to execute only 4 testcases.
93+
Remove it to check all the testcases (about 3800).
94+
95+
``` bash
96+
docker run --rm -it code_aster_seq:default run_testcases --test unstable
8497
```

run_testcases

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
3+
_usage()
4+
{
5+
echo "Run the testcases using a given version."
6+
echo
7+
echo "Usage: run_testcases [options] version"
8+
echo
9+
echo "Options:"
10+
echo
11+
echo " --help (-h) Print this help information and exit."
12+
echo " --np=N (-n N) Number of processes to run (default: $(nproc))."
13+
echo " --test (-t) Execute only few tests."
14+
echo
15+
exit "${1:-1}"
16+
}
17+
18+
WORK=/home/aster
19+
20+
run_main()
21+
{
22+
local version
23+
local short=0
24+
local cpu=$(nproc)
25+
26+
local option
27+
OPTS=$(getopt -o htn: --long help,test,np: -n $(basename $0) -- "$@")
28+
if [ $? != 0 ] ; then
29+
echo "invalid arguments." ; _usage 2
30+
fi
31+
eval set -- "$OPTS"
32+
while true; do
33+
case "$1" in
34+
-h | --help ) _usage ;;
35+
-t | --test ) short=1 ;;
36+
-n | --np ) cpu="$2" ; shift ;;
37+
-- ) shift ; break ;;
38+
* ) break ;;
39+
esac
40+
shift
41+
done
42+
if [ $# -ne 1 ] ; then
43+
echo "'version' argument missing." ; _usage 2
44+
fi
45+
version="$1"
46+
47+
[ ! -d ${WORK} ] && mkdir -p ${WORK}
48+
cd ${WORK}
49+
50+
# build testlist
51+
echo "building testlist..."
52+
as_run --nodebug_stderr --list --all --filter='"parallel" not in testlist' -o testlist
53+
local limit=99999
54+
test "$short" -eq "1" && limit=4
55+
shuf testlist | head -"${limit}" > list_run
56+
57+
cat << EOF > hostfile
58+
[localhost]
59+
cpu=${cpu}
60+
mem=9999999
61+
EOF
62+
63+
cat << EOF > astout.export
64+
# parameters
65+
P actions astout
66+
P version ${version}
67+
P debug nodebug
68+
P mode interactif
69+
P ncpus 1
70+
P nbmaxnook 500
71+
P cpresok RESOK
72+
P facmtps 3
73+
P tpsjob 300
74+
75+
F hostfile ${WORK}/hostfile D 0
76+
F list ${WORK}/list_run D 0
77+
R resu_test ${WORK}/resutest R 0
78+
EOF
79+
80+
# execute the testcases
81+
as_run --nodebug_stderr astout.export
82+
}
83+
84+
run_main "${@}"
85+
exit $?

0 commit comments

Comments
 (0)