UNPKG

1.49 kBapplication/x-shView Raw
1#! /bin/bash -e
2# Authenticate then submit an exercise and a job towards this exercise
3
4AGENT=./codegradxvmauthor.js
5HOSTNAME=vmauthor.codegradx.org
6HOSTIP=192.168.122.205
7
8[ -d tmp ] && rm -rf tmp
9mkdir -p tmp
10
11# Get credentials for author
12CREDENTIALS=tmp/fw4ex-author0.json
13wget -O $CREDENTIALS http://$HOSTIP/fw4exjson/0
14
15# Check credentials. Credentials are only valid a few hours so refresh
16# credentials for the rest of this script:
17$AGENT --ip=$HOSTIP --credentials=$CREDENTIALS --update-credentials || true
18
19# Submit an exercise
20EXOTGZ=spec/org.example.fw4ex.grading.check.tgz
21$AGENT --ip=$HOSTIP \
22 --credentials=$CREDENTIALS \
23 --type=exercise \
24 --xmldir=tmp \
25 --stuff=$EXOTGZ --follow
26
27# Check that the exercise is deployed
28[ -f tmp/2-exerciseAuthorReport.xml ] && \
29grep ' safecookie=' < tmp/2-exerciseAuthorReport.xml
30
31# Check that the marking reports of the pseudo jobs are present in XML and HTML
32[ -f tmp/5-jobStudentReport.xml ] && \
33[ -f tmp/8-jobStudentReport.html ]
34
35# Send an answer towards this new exercise. Use --counter not to overwrite
36# the previous reports in tmp/
37$AGENT --ip=$HOSTIP \
38 --credentials=$CREDENTIALS \
39 --type=job \
40 --xmldir=tmp \
41 --counter=100 \
42 --stuff=spec/oefgc/1.tgz --follow \
43 --exercise="file:tmp/2-exerciseAuthorReport.xml"
44
45# Check the obtained mark:
46[ -f tmp/102-jobStudentReport.xml ] && \
47grep -q ' mark="10" totalMark="100"' < tmp/102-jobStudentReport.xml && \
48echo OK
49
50# end of 20-exercise.sh