check: add basic testsuite

Version: 1-5
This commit is contained in:
Pavel Raiskup 2016-06-22 13:21:54 +02:00
parent 657cae1dad
commit ec18e42809

View File

@ -15,6 +15,8 @@ Release: 5%{?dist}
License: GPLv2+ License: GPLv2+
URL: https://fedoraproject.org/wiki/PackagingDrafts/MultilibTricks URL: https://fedoraproject.org/wiki/PackagingDrafts/MultilibTricks
BuildRequires: gcc
Source0: multilib-fix Source0: multilib-fix
Source1: macros.ml Source1: macros.ml
Source2: README Source2: README
@ -63,6 +65,51 @@ install -m 755 -p multilib-fix %{buildroot}/%{ml_fix}
install -m 755 -p multilib-info %{buildroot}/%{ml_info} install -m 755 -p multilib-info %{buildroot}/%{ml_info}
%check
mkdir tests ; cd tests
ml_fix="sh `pwd`/../multilib-fix --buildroot `pwd`"
capable="sh `pwd`/../multilib-info --multilib-capable"
mkdir template
cat > template/main.c <<EOF
#include "header.h"
int main () { call (); return 0; }
EOF
cat > template/header.h <<EOF
#include <stdio.h>
void call (void) { printf ("works!\n"); }
EOF
cp -r template basic
gcc ./basic/main.c
./a.out
pwd
if $capable; then
cp -r template really-works
$ml_fix --file /really-works/header.h
gcc really-works/main.c
./a.out
test -f really-works/header-*.h
fi
cp -r template other_arch
$ml_fix --file /other_arch/header.h --arch ppc64
test -f other_arch/header-*.h
cp -r template other_arch_fix
$ml_fix --file /other_arch_fix/header.h --arch ppc64p7
test -f other_arch_fix/header-ppc64.h
cp -r template aarch64-no-change
$ml_fix --file /aarch64-no-change/header.h --arch aarch64
test ! -f aarch64-no-change/header-*.h
test `$capable --arch x86_64` = true
test `$capable --arch aarch64` = false
test `$capable --arch ppc64p7` = true
%files %files
%license COPYING %license COPYING
%doc README %doc README
@ -73,6 +120,7 @@ install -m 755 -p multilib-info %{buildroot}/%{ml_info}
%changelog %changelog
* Wed Jun 22 2016 Pavel Raiskup <praiskup@redhat.com> - 1-5 * Wed Jun 22 2016 Pavel Raiskup <praiskup@redhat.com> - 1-5
- document why there is no need for '#else' in the replacement header - document why there is no need for '#else' in the replacement header
- add basic testsuite
* Mon Jun 13 2016 Pavel Raiskup <praiskup@redhat.com> - 1-4 * Mon Jun 13 2016 Pavel Raiskup <praiskup@redhat.com> - 1-4
- use '-' as a field separator by default - use '-' as a field separator by default