Jerry Flood | b88fc2d | 2017-04-12 09:46:44 -0400 | [diff] [blame] | 1 | ''' |
| 2 | Created on Apr 7, 2017 |
| 3 | |
| 4 | @author: jf9860 |
| 5 | ''' |
| 6 | from threading import Thread |
| 7 | import subprocess |
| 8 | import os |
| 9 | from datetime import datetime |
| 10 | import logging |
| 11 | |
| 12 | class RunEte(Thread): |
| 13 | ''' |
| 14 | classdocs |
| 15 | ''' |
| 16 | robot_test = "" |
| 17 | robot_command = "runEteTag.sh" |
| 18 | soaksubfolder = "" |
| 19 | test_number =0 |
| 20 | |
| 21 | def __init__(self, test_name, soaksubfolder, test_number): |
| 22 | ''' |
| 23 | Constructor |
| 24 | ''' |
| 25 | super(RunEte, self).__init__() |
| 26 | self.robot_test = test_name |
| 27 | self.soaksubfolder = soaksubfolder |
| 28 | self.test_number = test_number |
| 29 | |
| 30 | def run(self): |
| 31 | logging.info("{} ({}) started - {}".format(self.getName(), self.robot_test, str(datetime.now()))) |
| 32 | try: |
| 33 | ''' Add the '/' here so that the shell doesn't require a subfolder... ''' |
| 34 | env = dict(os.environ, SOAKSUBFOLDER=self.soaksubfolder + "/") |
| 35 | output = subprocess.check_output(["bash", self.robot_command, self.robot_test, self.test_number], shell=False, env=env) |
| 36 | logging.info("{} ({}) {}".format(self.getName(), self.robot_test, output)) |
DR695H | ae6fedd | 2019-05-01 18:52:33 -0400 | [diff] [blame^] | 37 | except Exception as e: |
Jerry Flood | b88fc2d | 2017-04-12 09:46:44 -0400 | [diff] [blame] | 38 | logging.error("{} ({}) Unexpected error {}".format(self.getName(), self.robot_test, repr(e))) |
| 39 | logging.info("{} ({}) ended - {}".format(self.getName(), self.robot_test, str(datetime.now()))) |