summaryrefslogtreecommitdiff
path: root/tools/ci/inria/light
blob: 25be40c88dc59b6d3491f7382e8c2f4b6dc88523 (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
#**************************************************************************
#*                                                                        *
#*                                 OCaml                                  *
#*                                                                        *
#*     Damien Doligez and Xavier Leroy, projet Cambium, INRIA Paris       *
#*                                                                        *
#*   Copyright 2020 Institut National de Recherche en Informatique et     *
#*     en Automatique.                                                    *
#*                                                                        *
#*   All rights reserved.  This file is distributed under the terms of    *
#*   the GNU Lesser General Public License version 2.1, with the          *
#*   special exception on linking described in the file LICENSE.          *
#*                                                                        *
#**************************************************************************

# This script performs a minimal build of the OCaml system
# sufficient to run the test suite.
# It is a lightweight version of the 'main' script, intended to run
# on slow machines such as QEMU virtual machines.
# It does not work under Windows.

# Environment variables that are honored:
#   OCAML_ARCH                architecture of the test machine
#   OCAML_JOBS                number of jobs to run in parallel (make -j)

# Command-line arguments:
# -jNN                    pass "-jNN" option to make for parallel builds

error () {
  echo "$1" >&2
  exit 3
}

# be verbose and stop on error
set -ex

# set up variables

# default values
make=make
jobs=''

memory_model_tests="tests/memory-model/forbidden.ml \
tests/memory-model/publish.ml"

case "${OCAML_ARCH}" in
  bsd|solaris)
    make=gmake
  ;;
  cygwin|cygwin64)
    export OCAMLTEST_SKIP_TESTS="$memory_model_tests"
  ;;
  mingw|mingw64|msvc|msvc64)
    error "Unsupported architecture ${OCAML_ARCH}"
  ;;
esac

case "${OCAML_JOBS}" in
  [1-9]|[1-9][0-9]) jobs="-j${OCAML_JOBS}" ;;
esac

#########################################################################
# parse optional command-line arguments

while [ $# -gt 0 ]; do
  case $1 in
    -j[1-9]|-j[1-9][0-9]) jobs="$1";;
    *) error "unknown option $1";;
  esac
  shift
done

#########################################################################
# Do the work

# Tell gcc to use only ASCII in its diagnostic outputs.
export LC_ALL=C

git clean -q -f -d -x

./configure \
   --disable-shared \
   --disable-debug-runtime \
   --disable-instrumented-runtime \
   --disable-dependency-generation \
   --disable-ocamldoc \
   --disable-stdlib-manpages

$make $jobs --warn-undefined-variables

cd testsuite
if test -n "$jobs" && test -x /usr/bin/parallel
then PARALLEL="$jobs $PARALLEL" $make --warn-undefined-variables parallel
else $make --warn-undefined-variables all
fi