|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# @copyright Copyright (c) contributors to Project Ocre, |
| 3 | +# which has been established as Project Ocre a Series of LF Projects, LLC |
| 4 | +# |
| 5 | +# SPDX-License-Identifier: Apache-2.0 |
| 6 | + |
| 7 | +import sys |
| 8 | +sys.path.append("../..") |
| 9 | + |
| 10 | +import testlib # noqa: E402 |
| 11 | +import pexpect # noqa: E402 |
| 12 | + |
| 13 | + |
| 14 | +def main(): |
| 15 | + serial_conn, pex = testlib.setup('/dev/ttyACM0') |
| 16 | + |
| 17 | + print("Creating container on board off of webserver-complex.wasm") |
| 18 | + pex.write( |
| 19 | + b'ocre run -n webserver-complex -k ocre:api -k networking webserver-complex.wasm\n') |
| 20 | + expect_index = pex.expect(["Minimal resource usage", pexpect.TIMEOUT], 30) |
| 21 | + runtime_output = bytes(pex.before).decode(errors='ignore') |
| 22 | + runtime_output += bytes(pex.after).decode(errors='ignore') |
| 23 | + |
| 24 | + if (expect_index == 1): |
| 25 | + print("Container failed to create container in given timeout") |
| 26 | + serial_conn.send_break() |
| 27 | + testlib.format_runtime_output(runtime_output, "Failed") |
| 28 | + testlib.full_exit(serial_conn, 1) |
| 29 | + |
| 30 | + if ("Failed to create container" in runtime_output) or ("Server Status: ONLINE" not in runtime_output): |
| 31 | + print("Failed to create container") |
| 32 | + testlib.format_runtime_output(runtime_output, "Failed") |
| 33 | + testlib.full_exit(serial_conn, 1) |
| 34 | + |
| 35 | + testlib.format_runtime_output(runtime_output, "Setup") |
| 36 | + testlib.full_exit(serial_conn, 0) |
| 37 | + |
| 38 | + |
| 39 | +if __name__ == "__main__": |
| 40 | + main() |
0 commit comments