Skip to content

Commit

Permalink
v2 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher McArthur committed Nov 14, 2022
1 parent cf11063 commit 332eb40
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions recipes/catch2/2.x.x/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def configure(self):
self.options.rm_safe("with_benchmark")

def package_id(self):
if not self.options.with_main:
if not self.info.options.with_main:
self.info.clear()

def layout(self):
Expand All @@ -55,7 +55,7 @@ def layout(self):
def validate(self):
if Version(self.version) < "2.13.1" and self.settings.arch == "armv8":
raise ConanInvalidConfiguration("ARMv8 is not supported by versions < 2.13.1+")
if self.options.with_main and Version(self.version) < "2.13.4":
if self.info.options.get_safe("with_main") and Version(self.version) < "2.13.4":
raise ConanInvalidConfiguration("Option with_main not supported by versions < 2.13.4")

def source(self):
Expand Down
10 changes: 10 additions & 0 deletions recipes/catch2/2.x.x/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout
import os
import yaml

class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
Expand All @@ -11,6 +12,10 @@ class TestPackageConan(ConanFile):

_tests_todo = []

@property
def _todos_filename(self):
return os.path.join(self.recipe_folder, self.folders.test_output, self.folders.generators,"catch2_test_to_do.yml")

def requirements(self):
self.requires(self.tested_reference_str)

Expand All @@ -29,6 +34,9 @@ def generate(self):
if not catch_opts.with_prefix and catch_opts.with_main and catch_opts.with_benchmark:
self._tests_todo.append("benchmark")

with open(self._todos_filename, "w") as file:
yaml.dump(self._tests_todo, file)

def layout(self):
cmake_layout(self)

Expand All @@ -38,6 +46,8 @@ def build(self):
cmake.build()

def test(self):
with open(self._todos_filename, "r") as file:
self._tests_todo = yaml.safe_load(file)
if can_run(self):
for test_name in self._tests_todo:
self.run(os.path.join(self.cpp.build.bindirs[0], test_name), env="conanrun")

0 comments on commit 332eb40

Please sign in to comment.