Skip to content

Commit

Permalink
Add more test logging #3
Browse files Browse the repository at this point in the history
  • Loading branch information
jimporter committed Nov 1, 2021
1 parent 0d0e5be commit a93214e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
.\setup-x86_64.exe -qgnNdO -R %CYGROOT% -l %CYGCACHE%
-s http://mirrors.kernel.org/sourceware/cygwin/
-P cmake,gcc-g++,git,libboost-devel,make,ninja,pkg-config,python38
-P python38-pip,python38-setuptools
-P python38-pip,python38-setuptools,python38-wheel
- name: Copy mopack to Cygwin
run: |
echo "MOPACK_LIB_NAMES=lib{}.dll.a" >> .mopack_test_env
Expand All @@ -151,16 +151,17 @@ jobs:
C:\cygwin\bin\bash -lc
"cd bfg9000 && pip3.8 install ./bfg9000 '.[test]'"
- name: Run tests
timeout-minutes: 5
run: >
C:\cygwin\bin\bash -lc
"cd bfg9000 && python3.8 setup.py coverage -q && coverage xml"
- name: Copy coverage from Cygwin
run: |
copy C:\cygwin\home\runneradmin\bfg9000\coverage.xml .
- name: Upload coverage
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
"cd bfg9000 && python3.8 setup.py test -s test.integration.test_sdist_cmake"
# - name: Copy coverage from Cygwin
# run: |
# copy C:\cygwin\home\runneradmin\bfg9000\coverage.xml .
# - name: Upload coverage
# uses: codecov/codecov-action@v2
# with:
# files: ./coverage.xml
lint:
runs-on: ubuntu-latest

Expand Down
5 changes: 5 additions & 0 deletions test/integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,15 @@ class IntegrationTest(SubprocessTestCase):
deploy = False

def setUp(self):
import sys
print('setup 0', file=sys.stderr)
self.stage = stage_dir(self.name)
print('setup 1', file=sys.stderr)
self.pkgbuilddir = os.path.join(self.stage, 'mopack', 'build')
print('setup 2', file=sys.stderr)
if self.deploy:
self.prefix = stage_dir(self.name + '-install', chdir=False)
print('setup 3', file=sys.stderr)

def assertUsage(self, name, usage='', extra_args=[], *, format='json',
submodules=[], extra_env=usage_env, returncode=0):
Expand Down
14 changes: 14 additions & 0 deletions test/integration/test_sdist_cmake.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
import sys

from mopack.path import pushd
from mopack.platforms import platform_name
Expand All @@ -12,6 +13,7 @@ class TestInnerCMake(IntegrationTest):
deploy = True

def test_resolve(self):
print('inner started', file=sys.stderr)
config = os.path.join(test_data_dir, 'mopack-inner-cmake.yml')
self.assertPopen(['mopack', 'resolve', config,
'-Pprefix=' + self.prefix])
Expand Down Expand Up @@ -66,16 +68,23 @@ def test_resolve(self):
self.assertExists(include_prefix + 'greeter.hpp')
self.assertExists(lib_prefix + 'pkgconfig/greeter.pc')
self.assertExists('include/hello.hpp')
print('inner DONE', file=sys.stderr)


class TestOuterCMake(IntegrationTest):
name = 'outer-cmake'
deploy = True

def __init__(self, *args, **kwargs):
print('xxx 0', file=sys.stderr)
super().__init__(*args, **kwargs)

def test_resolve(self):
print('xxx 1', file=sys.stderr)
config = os.path.join(test_data_dir, 'mopack-outer-cmake.yml')
self.assertPopen(['mopack', 'resolve', config,
'-Pprefix=' + self.prefix])
print('xxx 2', file=sys.stderr)
self.assertExists('mopack/build/greeter/')
self.assertExists('mopack/logs/greeter.log')
self.assertExists('mopack/build/hello/')
Expand All @@ -86,8 +95,10 @@ def test_resolve(self):
library_path = [os.path.join(self.pkgbuilddir, 'greeter')]
self.assertPathUsage('greeter', include_path=include_path,
library_path=library_path, version='1.0')
print('xxx 3', file=sys.stderr)

self.assertPkgConfigUsage('hello')
print('xxx 4', file=sys.stderr)

output = json.loads(slurp('mopack/mopack.json'))
self.assertEqual(output['metadata'], {
Expand Down Expand Up @@ -123,11 +134,14 @@ def test_resolve(self):
),
],
})
print('xxx 5', file=sys.stderr)

self.assertPopen(['mopack', 'deploy'])
print('xxx 6', file=sys.stderr)
include_prefix = '' if platform_name() == 'windows' else 'include/'
lib_prefix = '' if platform_name() == 'windows' else 'lib/'
with pushd(self.prefix):
self.assertExists('include/greeter.hpp')
self.assertExists(include_prefix + 'hello.hpp')
self.assertExists(lib_prefix + 'pkgconfig/hello.pc')
print('xxx 7', file=sys.stderr)

0 comments on commit a93214e

Please sign in to comment.