| 1 |
import logging |
| 2 |
|
| 3 |
from base_utils import get_temp_file, get_temp_dir |
| 4 |
from pbcommand.engine import run_cmd |
| 5 |
|
| 6 |
log = logging.getLogger(__name__) |
| 7 |
|
| 8 |
|
| 9 |
class RunnerSmokeTest: |
| 10 |
|
| 11 |
def test_simple_run_cmd(self): |
| 12 |
d = get_temp_dir("simple-cmd") |
| 13 |
txt_in = get_temp_file(".txt", d) |
| 14 |
txt_out = get_temp_file("*.txt", d) |
| 15 |
exe = "cat {i} > {o}".format(i=txt_in, o=txt_out) |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
stdout = get_temp_file("-stdout", d) |
| 23 |
stderr = get_temp_file("-stderr", d) |
| 24 |
with open(stdout, 'w') as fo: |
| 25 |
with open(stderr, 'w') as fe: |
| 26 |
result = run_cmd(exe, fo, fe) |
| 27 |
|
| 28 |
emgs = "Command {e} failed".format(e=exe) |
| 29 |
if result.exit_code != 0: |
| 30 |
print(emgs) |
| 31 |
assert result.exit_code == 0 |