public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob c3cb596aa4048cd8b99110daff9668863945a28e 2837 bytes (raw)

 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
 
#! /usr/bin/python3

# SPDX-License-Identifier: GPL-2.0-or-later
#
# avocado/build.py - Tests for various make targets
#
# Copyright Red Hat
# Author: David Gibson <david@gibson.dropbear.id.au>

import os
import os.path
import shutil
import sys

import avocado

import common


class BuildTest(common.BaseTest):
    # Some of these can take a little while
    timeout = 30.0

    def setUp(self):
        super().setUp()

        # Make a temporary copy of the sources
        srcfiles = self.hostx('git ls-files').splitlines()
        for src in srcfiles:
            dst = os.path.join(bytes(self.workdir, 'utf-8'), src)
            os.makedirs(os.path.dirname(dst), exist_ok=True)
            shutil.copy(src, dst)
        os.chdir(self.workdir)

    def build_target(self, target, outputs=None):
        if outputs is None:
            outputs = [target]
        for o in outputs:
            self.assertFalse(os.path.exists(o))
        self.hostx('make {} CFLAGS="-Werror"'.format(target))
        for o in outputs:
            self.assertTrue(os.path.isfile(o))
        self.hostx('make clean')
        for o in outputs:
            self.assertFalse(os.path.exists(o))

    def test_make_passt(self):
        self.build_target('passt')

    def test_make_pasta(self):
        self.build_target('pasta')

    def test_make_qrap(self):
        self.build_target('qrap')

    def test_make_all(self):
        self.build_target('all', ['passt', 'pasta', 'qrap'])

    def test_make_install_uninstall(self):
        prefix = os.path.join(self.workdir, "prefix")
        os.makedirs(prefix)

        # Install
        self.hostx('make install CFLAGS="-Werror" prefix={}'.format(prefix))
        self.assertTrue(os.path.isfile(os.path.join(prefix, 'bin/passt')))
        self.assertTrue(os.path.isfile(os.path.join(prefix, 'bin/pasta')))
        self.assertTrue(os.path.isfile(os.path.join(prefix, 'bin/qrap')))
        mandir = os.path.join(prefix, 'share/man')
        self.hostx('man -M {} -W passt'.format(mandir))
        self.hostx('man -M {} -W pasta'.format(mandir))
        self.hostx('man -M {} -W qrap'.format(mandir))

        # Uninstall
        self.hostx('make uninstall prefix={}'.format(prefix))
        self.assertFalse(os.path.exists(os.path.join(prefix, 'bin/passt')))
        self.assertFalse(os.path.exists(os.path.join(prefix, 'bin/pasta')))
        self.assertFalse(os.path.exists(os.path.join(prefix, 'bin/qrap')))
        self.assertRaises(avocado.utils.process.CmdError,
                          self.hostx, 'man -M {} -W passt'.format(mandir))
        self.assertRaises(avocado.utils.process.CmdError,
                          self.hostx, 'man -M {} -W pasta'.format(mandir))
        self.assertRaises(avocado.utils.process.CmdError,
                          self.hostx, 'man -M {} -W qrap'.format(mandir))

debug log:

solving c3cb596 ...
found c3cb596 in https://archives.passt.top/passt-dev/20230420011108.494181-5-david@gibson.dropbear.id.au/

applying [1/1] https://archives.passt.top/passt-dev/20230420011108.494181-5-david@gibson.dropbear.id.au/
diff --git a/avocado/build.py b/avocado/build.py
new file mode 100644
index 0000000..c3cb596

Checking patch avocado/build.py...
Applied patch avocado/build.py cleanly.

index at:
100644 c3cb596aa4048cd8b99110daff9668863945a28e	avocado/build.py

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).