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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
#!/bin/sh
# Basic checks for check_ali_update.sh.
# Copyright (C) 2021 Nicolas Boulenguez <nicolas@debian.org>
set -Ceuvx
# Stop here if test_check_ali_update_tmp/ already exists.
mkdir test_check_ali_update_tmp
cd test_check_ali_update_tmp
mkdir d2
check() {
status=0
sh ../check_ali_update.sh d1 d2 > stdout 2> stderr || status=$?
test $status = $1
diff -u expected_out stdout
echo -n | diff -u - stderr
rm expected_out stderr stdout
}
mkdir d1
echo -n > expected_out
DEB_FAIL_ON_ADA_LIB_INFO_CHANGE= check 0
echo -n > expected_out
DEB_FAIL_ON_ADA_LIB_INFO_CHANGE=1 check 0
mkdir d1/adainclude d1/adalib
echo 'normal spec' > d1/adainclude/normal.ads
echo 'normal body' > d1/adainclude/normal.adb
cat > d1/adalib/normal.ali <<EOF
normal ali file
D normal.ads 01
EOF
cp d1/adainclude/normal.ads d1/adainclude/normal.adb d1/adalib/normal.ali d2
echo -n > expected_out
DEB_FAIL_ON_ADA_LIB_INFO_CHANGE= check 0
echo -n > expected_out
DEB_FAIL_ON_ADA_LIB_INFO_CHANGE=1 check 0
echo 'new spec' > d2/news.ads
cat > d2/new.ali <<EOF
new ali file
D new.ads 01
EOF
echo -n > expected_out
DEB_FAIL_ON_ADA_LIB_INFO_CHANGE= check 0
echo -n > expected_out
DEB_FAIL_ON_ADA_LIB_INFO_CHANGE=1 check 0
echo 'vanished spec' > d1/adainclude/changed.ads
cat > d1/adalib/changed.ali <<EOF
changed ali file
D changed.ads 02
EOF
cat > expected_out <<EOF
error: changes in Ada Library Information files.
You are seeing this because
* build and host GCC major versions match.
* build_type=build-native and with_libgnat=yes in debian/rules.defs.
* vanished files : changed.ali
diff: d2/changed.ads: No such file or directory
This may break Ada packages, see https://people.debian.org/~lbrenta/debian-ada-policy.html.
If you are uploading to Debian, please contact debian-ada@lists.debian.org.
EOF
DEB_FAIL_ON_ADA_LIB_INFO_CHANGE= check 0
cat > expected_out <<EOF
error: changes in Ada Library Information files.
You are seeing this because
* build and host GCC major versions match.
* build_type=build-native and with_libgnat=yes in debian/rules.defs.
* vanished files : changed.ali
diff: d2/changed.ads: No such file or directory
This may break Ada packages, see https://people.debian.org/~lbrenta/debian-ada-policy.html.
If you are uploading to Debian, please contact debian-ada@lists.debian.org.
Build interrupted by DEB_FAIL_ON_ADA_LIB_INFO_CHANGE (from env or rules.defs).
EOF
DEB_FAIL_ON_ADA_LIB_INFO_CHANGE=1 check 1
sed s/vanished/changed/ d1/adainclude/changed.ads > d2/changed.ads
sed s/02/03/ d1/adalib/changed.ali > d2/changed.ali
cat > expected_out <<EOF
error: changes in Ada Library Information files.
You are seeing this because
* build and host GCC major versions match.
* build_type=build-native and with_libgnat=yes in debian/rules.defs.
* differing files: changed.ali
--- d1/adainclude/changed.ads
+++ d2/changed.ads
@@ -1 +1 @@
-vanished spec
+changed spec
This may break Ada packages, see https://people.debian.org/~lbrenta/debian-ada-policy.html.
If you are uploading to Debian, please contact debian-ada@lists.debian.org.
EOF
DEB_FAIL_ON_ADA_LIB_INFO_CHANGE= check 0
cat > expected_out <<EOF
error: changes in Ada Library Information files.
You are seeing this because
* build and host GCC major versions match.
* build_type=build-native and with_libgnat=yes in debian/rules.defs.
* differing files: changed.ali
--- d1/adainclude/changed.ads
+++ d2/changed.ads
@@ -1 +1 @@
-vanished spec
+changed spec
This may break Ada packages, see https://people.debian.org/~lbrenta/debian-ada-policy.html.
If you are uploading to Debian, please contact debian-ada@lists.debian.org.
Build interrupted by DEB_FAIL_ON_ADA_LIB_INFO_CHANGE (from env or rules.defs).
EOF
DEB_FAIL_ON_ADA_LIB_INFO_CHANGE=1 check 1
cd ..
rm -fr test_check_ali_update_tmp/
echo "All tests passed"
|