#!/bin/sh

# Non-root part of 40multiarch-root.
# Extends unit-tests/70multiarch.

. ./test_helper.sh

mkdir -p "$AUTOPKGTEST_TMP/pkg/debian"
cd       "$AUTOPKGTEST_TMP/pkg"

fake_changelog > debian/changelog

{
    fake_control_header 'libc6:i386, libglib2.0-data'
    # python3

    fake_control_package same-native    all '${dh-builtusing:libc6}'
    fake_control_package same-other     all '${dh-builtusing:libc6:i386}'
    fake_control_package foreign-native all '${dh-builtusing:dpkg-dev}'
    fake_control_package foreign-other  all '${dh-builtusing:libglib2D0-data}'
    fake_control_package allowed-native all '${dh-builtusing:make}'
    # fake_control_package allowed-other  all '${dh-builtusing:python3}'

} > debian/control

dh_builtusing --logorrheic

check_substvar same-native    libc6           glibc
check_substvar same-other     libc6:i386      glibc
check_substvar foreign-native dpkg-dev        dpkg
check_substvar foreign-other  libglib2D0-data glib2.0
check_substvar allowed-native make            make-dfsg
# check_substvar allowed-other  python3         python3-defaults

dh_gencontrol

check_control same-native    glibc
check_control same-other     glibc
check_control foreign-native dpkg
check_control foreign-other  glib2.0
check_control allowed-native make-dfsg
# check_control allowed-other  python3-defaults
