Ejemplo n.º 1
0
def test_file_destination():
    arch_file = File(os.path.join(ldd_output_directory, 'htop-arch.txt'))
    arch_directory = os.path.dirname(arch_file.destination)
    fizz_buzz_file = File(fizz_buzz_glibc_32, chroot=chroot)
    fizz_buzz_directory = os.path.dirname(fizz_buzz_file.destination)
    assert arch_directory == fizz_buzz_directory, \
        'Executable and non-executable files should be written to the same directory.'
Ejemplo n.º 2
0
def test_file_hash():
    amazon_file = File(os.path.join(ldd_output_directory, 'htop-amazon-linux.txt'))
    arch_file = File(os.path.join(ldd_output_directory, 'htop-arch.txt'))
    assert amazon_file.hash != arch_file.hash, 'The hashes should differ.'
    assert len(amazon_file.hash) == len(arch_file.hash) == 64, \
        'The hashes should have a consistent length of 64 characters.'

    # Found by executing `sha256sum fizz-buzz`.
    expected_hash = 'd54ab4714215d7822bf490df5cdf49bc3f32b4c85a439b109fc7581355f9d9c5'
    assert File(fizz_buzz_glibc_32, chroot=chroot).hash == expected_hash, 'Hashes should match.'
Ejemplo n.º 3
0
def test_file_requires_launcher(fizz_buzz):
    file = File(fizz_buzz, chroot=chroot)
    assert file.requires_launcher, 'Fizz buzz should require a launcher.'
    assert all(not dependency.requires_launcher for dependency in file.elf.dependencies), \
        'All of the dependencies should not require launchers.'
Ejemplo n.º 4
0
def test_file_elf():
    fizz_buzz_file = File(fizz_buzz_glibc_32, chroot=chroot)
    arch_file = File(os.path.join(ldd_output_directory, 'htop-arch.txt'))
    assert fizz_buzz_file.elf, 'The fizz buzz executable should be an ELF binary.'
    assert not arch_file.elf, 'The arch text file should not be an ELF binary.'