diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 4849b0d7..88b2b2be 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -84,7 +84,6 @@ def runExamples(Map ctxt) { } echo "Running examples with CONAN_HOME: ${env.CONAN_HOME}" for (example in ctxt.examples) { - ctxt.shFunction('conan remove "*" -c') runExample(ctxt, example) } } @@ -162,7 +161,7 @@ node('Linux') { conanBranchesInstalls.each { branch -> stage("${branch.name}: Run Macos examples") { withEnv(["PYENV_ROOT=/Users/jenkins/.pyenv", "PATH+EXTRA=/Users/jenkins/.pyenv/shims:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin"]) { - runExamples([python_host: '/Users/jenkins/.pyenv/versions/3.9.11/bin/python', + runExamples([python_host: '/Users/jenkins/.pyenv/versions/3.9.10/bin/python', shFunction: { data -> sh(data) }, isInsideDocker: false, runningUnix: true, diff --git a/examples/cross_build/android/ndk_basic/run_example.py b/examples/cross_build/android/ndk_basic/run_example.py index 5c6bb739..6e2825b0 100644 --- a/examples/cross_build/android/ndk_basic/run_example.py +++ b/examples/cross_build/android/ndk_basic/run_example.py @@ -32,5 +32,3 @@ _f.write(profile) run("conan new -d name=foo -d version=1.0 cmake_lib") output = run("conan create . --profile ./android") - if platform.system() != "Linux": # Linux with CMake 3.15 builds but print warns instead of this msg - assert "Targeting API '21' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'" in output diff --git a/test/examples_tools.py b/test/examples_tools.py index 6b81458c..af2d777a 100644 --- a/test/examples_tools.py +++ b/test/examples_tools.py @@ -2,6 +2,7 @@ import subprocess import shutil from contextlib import contextmanager +import time @contextmanager @@ -40,22 +41,28 @@ def tmp_dir(newdir): def run(cmd, error=False): - process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) - out, err = process.communicate() - out = out.decode("utf-8") - err = err.decode("utf-8") - ret = process.returncode - - output = err + out print("Running: {}".format(cmd)) - print("----- OUTPUT -------") - print(output) - print("----END OUTPUT------") + start_time = time.time() + + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True, text=True) + + output = '' + + for line in iter(process.stdout.readline, ''): + print(line, end='', flush=True) + output += line + + ret = process.wait() + end_time = time.time() + + elapsed_time = end_time - start_time + print(f"Elapsed time: {elapsed_time:.2f} seconds") + if ret != 0 and not error: - raise Exception("Failed cmd: {}\n{}".format(cmd, output)) + raise Exception(f"Failed cmd: {cmd}\n{output}") if ret == 0 and error: - raise Exception( - "Cmd succeded (failure expected): {}\n{}".format(cmd, output)) + raise Exception(f"Cmd succeeded (failure expected): {cmd}\n{output}") + return output