-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckenv.sh
More file actions
executable file
·72 lines (64 loc) · 2.05 KB
/
checkenv.sh
File metadata and controls
executable file
·72 lines (64 loc) · 2.05 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# DO NOT EDIT THIS FILE
environment=good
OCAMLV=4.06.1
OUNITV=2.0.8
YOJSONV=1.5.0
OPAM_LOCATION="$(command -v opam)"
if [[ $OPAM_LOCATION == "" ]]; then
echo "OPAM is NOT available. This is bad."
environment=bad
else
echo "OPAM is available. Good."
fi
SWITCH="$(opam switch show 2>&1)"
if [[ $SWITCH == $OCAMLV ]]; then
echo "OPAM switch $OCAMLV is active. Good."
else
echo "OPAM switch $OCAMLV is NOT active. This is bad."
echo "The active switch is: $SWITCH"
environment=bad
fi
OCAMLC_VERSION="$(ocamlc --version 2>&1)"
if [[ $OCAMLC_VERSION == $OCAMLV ]]; then
echo "OCaml compiler version $OCAMLV is active. Good."
else
echo "OCaml compiler version $OCAMLV is NOT active. This is bad."
echo "The active version is: $OCAMLC_VERSION"
environment=bad
fi
OUNIT_VERSION="$(opam info ounit -f version 2>&1)"
if [[ $OUNIT_VERSION =~ $OUNITV ]]; then
echo "OUnit version $OUNITV is active. Good."
else
echo "OUnit version $OUNITV is NOT active. This is bad."
echo "The active version of OUnit is: $OUNIT_VERSION"
environment=bad
fi
YOJSON_VERSION="$(opam info yojson -f version 2>&1)"
if [[ $YOJSON_VERSION =~ $YOJSONV ]]; then
echo "Yojson version $YOJSONV is active. Good."
else
echo "Yojson version $YOJSONV is NOT active. This is bad."
echo "The active version of Yojson is: $YOJSON_VERSION"
environment=bad
fi
if [[ $environment == good ]]; then
cat <<EOF
===========================================================
Your OCaml environment looks good to me. Congratulations!
===========================================================
EOF
else
cat <<EOF
===========================================================
WARNING
Your OCaml environment looks broken to me. The code that
you submit might not compile on the grader's machine,
leading to heavy penalties. Please fix your OCaml
environment. Check the error messages above carefully to
determine what is wrong with your environment. See a
consultant for help if you cannot determine what is wrong.
===========================================================
EOF
fi