Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Improve output while testing and use M2 Mac node #124

Merged
merged 9 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions examples/cross_build/android/ndk_basic/run_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 20 additions & 13 deletions test/examples_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import subprocess
import shutil
from contextlib import contextmanager
import time


@contextmanager
Expand Down Expand Up @@ -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


Expand Down