mirror of
https://github.com/curl/curl.git
synced 2026-08-25 18:23:44 +03:00
build: add pytest targets
It enables running pytests in cmake jobs, regardless of underlying build tool choice (= makes it work with ninja.) Also: - drop pytest logic launching `make` and exiting in case of failure. Maybe there is a better way and keep this functionality somehow, bind it to a command-line option? make it fail softly? - GHA/linux: invoke pytest via the build, not directly. - autotools: add missing dummy runtests targets when cross-compiling. Closes #15034
This commit is contained in:
parent
ed766751cc
commit
d82f9f965c
7 changed files with 49 additions and 17 deletions
|
|
@ -22,6 +22,8 @@
|
|||
#
|
||||
###########################################################################
|
||||
|
||||
add_custom_target(test-http-clients)
|
||||
|
||||
# Get 'check_PROGRAMS' variable
|
||||
transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
|
|
@ -30,6 +32,7 @@ foreach(_target IN LISTS check_PROGRAMS)
|
|||
set(_target_name "curlt-client-${_target}")
|
||||
add_executable(${_target_name} EXCLUDE_FROM_ALL "${_target}.c")
|
||||
add_dependencies(testdeps ${_target_name})
|
||||
add_dependencies(test-http-clients ${_target_name})
|
||||
target_include_directories(${_target_name} PRIVATE
|
||||
"${CURL_BINARY_DIR}/lib" # for "curl_config.h"
|
||||
"${CURL_SOURCE_DIR}/lib" # for "curl_setup.h"
|
||||
|
|
|
|||
|
|
@ -73,8 +73,6 @@ def env(pytestconfig) -> Env:
|
|||
pytest.skip(env.incomplete_reason())
|
||||
|
||||
env.setup()
|
||||
if not env.make_clients():
|
||||
pytest.exit(1)
|
||||
return env
|
||||
|
||||
@pytest.fixture(scope="package", autouse=True)
|
||||
|
|
|
|||
|
|
@ -579,12 +579,3 @@ class Env:
|
|||
i = int(fsize / line_length) + 1
|
||||
fd.write(f"{i:09d}-{s}"[0:remain-1] + "\n")
|
||||
return fpath
|
||||
|
||||
def make_clients(self):
|
||||
client_dir = os.path.join(self.project_dir, 'tests/http/clients')
|
||||
p = subprocess.run(['make'], capture_output=True, text=True,
|
||||
cwd=client_dir)
|
||||
if p.returncode != 0:
|
||||
pytest.exit(f"`make`in {client_dir} failed:\n{p.stderr}")
|
||||
return False
|
||||
return True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue