Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add tests for isolated builds #444

Merged
merged 1 commit into from
Mar 17, 2017
Merged

Conversation

mikepurvis
Copy link
Member

These should fail until #443 is merged.

@mikepurvis mikepurvis force-pushed the add-isolated-tests branch 5 times, most recently from 2cfa1b6 to f5de6c1 Compare March 14, 2017 16:15
@@ -50,7 +48,8 @@ def create_tree_workspace(wf, build_type, n_pkg_layers, n_children=2):
for i in range(n_pkgs):
wf.create_package(
'pkg_{}'.format(i),
depends=(['pkg_{}'.format(floor(i - 1) / n_children)] if i > 0 else []))
build_type=build_type,
depends=(['pkg_{}'.format(int((i - 1) / n_children))] if i > 0 else []))
Copy link
Member Author

@mikepurvis mikepurvis Mar 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously ignoring the passed-in build_type, and the use of floor was resulting in dependencies like pkg_2.0.

assert catkin_success(BUILD)
assert os.path.exists('devel/pkg_dep')
assert not os.path.exists('install')
assert_no_warnings(out)
Copy link
Member Author

@mikepurvis mikepurvis Mar 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could condense these into one, but I'm not sure it's worth it from a readability standpoint.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me.

@mikepurvis
Copy link
Member Author

Good to go in now. Can confirm that this passes locally when rebased on top of the changes from #443.

"""Test building dependent catkin packages with isolated installspace."""
with redirected_stdio() as (out, err):
with workspace_factory() as wf:
n_pkgs = create_tree_workspace(wf, 'catkin', 2)
Copy link
Member Author

@mikepurvis mikepurvis Mar 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not possible to test plain CMake packages in this way, since the simplified factory-generated ones don't include CMake modules which make them findable by dependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, unless you wanted to test something about a plain cmake package being a leaf. Also, despite that drawback, this function could be useful to get started and the test could add a CMake Module for the plain cmake package itself.

cmake_minimum_required(VERSION 2.8.3)
project({name})
find_package(catkin REQUIRED COMPONENTS {catkin_components})
catkin_package()"""
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a simplifying assumption here that a factory catkin package only depends on other catkin packages. All current tests pass with this assumption in place, so I see no reason to over complicate things.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, but at some point tests may just have to hand craft a CMakeLists.txt and not rely on a more and more complex function to generate everything for them.

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

"""Test building dependent catkin packages with isolated installspace."""
with redirected_stdio() as (out, err):
with workspace_factory() as wf:
n_pkgs = create_tree_workspace(wf, 'catkin', 2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, unless you wanted to test something about a plain cmake package being a leaf. Also, despite that drawback, this function could be useful to get started and the test could add a CMake Module for the plain cmake package itself.

assert catkin_success(BUILD)
assert os.path.exists('devel/pkg_dep')
assert not os.path.exists('install')
assert_no_warnings(out)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me.

cmake_minimum_required(VERSION 2.8.3)
project({name})
find_package(catkin REQUIRED COMPONENTS {catkin_components})
catkin_package()"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, but at some point tests may just have to hand craft a CMakeLists.txt and not rely on a more and more complex function to generate everything for them.

@wjwwood
Copy link
Member

wjwwood commented Mar 16, 2017

I restarted travis, but not sure if this has to be rebased instead.

@wjwwood
Copy link
Member

wjwwood commented Mar 16, 2017

The Linux jobs look ok, just waiting on Travis' macOS jobs to catch up.

@wjwwood wjwwood merged commit fb324dd into catkin:master Mar 17, 2017
@mikepurvis mikepurvis deleted the add-isolated-tests branch March 17, 2017 14:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants