#!/bin/sh
set -C -e -f -u
cd "$ADTTMP"

# Before the bug fix, gprbuild would try to write in a library
# directory when processing -s. When that library is installed (so
# gprbuild does not have write permission), gprbuild would crash on
# a permissions error. So we need a non-default installed library to
# show the bug.

cat > m.adb <<EOF
with Gnatvsn;
procedure M is
begin
   null;
end M;
EOF
cat > p.gpr <<EOF
with "gnatvsn.gpr";
project P is
   for Main use ("m.adb");
end P;
EOF

# test that default gpr search path follows Debian Ada policy
# test that -s (check switches) doesn't attempt to write in system directories
gprbuild -s p.gpr
gprclean p.gpr
