xref: /aosp_15_r20/external/google-fruit/extras/scripts/postsubmit.sh (revision a65addddcf69f38db5b288d787b6b7571a57bb8f)
1#!/bin/bash
2
3set -e
4
5: ${N_JOBS:=2}
6
7if [ "$STL" != "" ]
8then
9  STLARG="-stdlib=$STL"
10fi
11
12case $OS in
13linux*)
14    case $OS in
15    linux)     DOCKER_IMAGE="polettimarco/fruit-basesystem:ubuntu-$UBUNTU" ;;
16    linux-arm) docker run --rm --privileged multiarch/qemu-user-static:register --reset
17               DOCKER_IMAGE="polettimarco/fruit-basesystem:ubuntu_arm-$UBUNTU" ;;
18    esac
19    docker rm -f fruit &>/dev/null || true
20    docker run -d -it --name fruit --privileged "${DOCKER_IMAGE}"
21    docker exec fruit mkdir fruit
22    docker cp . fruit:/fruit
23
24    docker exec fruit bash -c "
25        export COMPILER=$COMPILER;
26        export N_JOBS=$N_JOBS;
27        export STLARG=$STLARG;
28        export ASAN_OPTIONS=$ASAN_OPTIONS;
29        export OS=$OS;
30        cd fruit; extras/scripts/postsubmit-helper.sh $1"
31    exit $?
32    ;;
33
34osx)
35    # This adds python-installed executables to PATH (notably py.test).
36    export PATH="$(brew --prefix)/bin:$PATH"
37
38    export COMPILER
39    export N_JOBS
40    export STLARG
41    export ASAN_OPTIONS
42    export OS
43    extras/scripts/postsubmit-helper.sh "$@"
44    exit $?
45    ;;
46
47*)
48    echo "Unsupported OS: $OS"
49    exit 1
50esac
51