set-opipefail
pushd/usr/share/apt/tests/
# force the target arch for the tests## By default, the packages would be built for the arch detected by rpm-build# (rpmbuild --eval %_arch). On installation, they would be compared# by rpm for compatibility with the arch detected by rpm. Currently,# the mismatch in the detection between rpm and rpm-build can lead to problems,# at least, on armh. So, we set the target by force to a value that must work.system_arch="$(rpm -q rpm --qf='%{ARCH}')"exportAPT_TEST_TARGET="$system_arch"# prepare data for rpm --importAPT_TEST_GPGPUBKEY="$PWD"/example-pubkey.asc
gpg-keygen--passphrase''\
--name-real'Some One'--name-emailsomeone@example.com\
/dev/null"$APT_TEST_GPGPUBKEY"exportAPT_TEST_GPGPUBKEY
# Below we run the same tests many times in order to possibly catch# bad races. (It's more probable to catch a race under heavy load;# therefore, of the total specified number of tries, we do# simultaneously as many as reasonable and possibly even more than TRIES.)# To not run in parallel, build the pkg with --define 'nprocs_for_check %nil'# Consider multiplying `nproc` by 2 for heavier load.NPROCS=`nproc`
if!["$NPROCS"-gt0]2>/dev/null;then
NPROCS=1
fi
TRIES=2
if[$TRIES-lt${NPROCS:-0}];then
TRIES=$NPROCS
fi
already_once=0
for((try=0;try<TRIES;));do
# all methods (you might want to update the list if there are new ones)formethodinfilecdromhttphttps;do
# do the same method several times in parallel (to provoke races)for((repeat=0;repeat<2;++repeat));do
echo"$((try++)):$method"if((already_once&&(try>=TRIES)));then
break2
fi
done
done
already_once=1
done|
xargs-d'\n'-I'{}'${NPROCS:+-P$NPROCS--process-slot-var=PARALLEL_SLOT}\
--sh-efuopipefail\
-c'APT_TEST_METHODS={}
APT_TEST_METHODS="${APT_TEST_METHODS#*:}"exportAPT_TEST_METHODS
\
./run-tests-v'${NPROCS:+'|&sed--unbuffered-e"s/^/[$PARALLEL_SLOT {}] /"'}