@@ -0,0 +1,1800 @@
+import functional_general_test%0Afrom trex import CTRexScenario%0Aimport os, sys%0Afrom subprocess import Popen, STDOUT%0Aimport shlex%0Aimport time%0Aimport errno%0Aimport tempfile%0A%0A# runs command%0Adef run_command(command, timeout = 15, poll_rate = 0.1, cwd = None):%0A    # pipes might stuck, even with timeout%0A    with tempfile.TemporaryFile() as stdout_file:%0A        proc = Popen(shlex.split(command), stdout = stdout_file, stderr = STDOUT, cwd = cwd, close_fds = True, universal_newlines = True)%0A        if timeout %3E 0:%0A            for i in range(int(timeout/poll_rate)):%0A                time.sleep(poll_rate)%0A                if proc.poll() is not None: # process stopped%0A                    break%0A            if proc.poll() is None:%0A                proc.kill() # timeout%0A                stdout_file.seek(0)%0A                return (errno.ETIME, '%25s%5Cn%5Cn...Timeout of %25s second(s) is reached!' %25 (stdout_file.read().decode(errors = 'replace'), timeout))%0A        else:%0A            proc.wait()%0A        stdout_file.seek(0)%0A        return (proc.returncode, stdout_file.read().decode(errors = 'replace'))%0A%0A%0Aclass CPP_Test(functional_general_test.CGeneralFunctional_Test):%0A    def test_gtests_all(self):%0A        print('')%0A        bp_sim = os.path.join(CTRexScenario.scripts_path, 'bp-sim-64')%0A        ret, out = run_command('%25s --ut' %25 bp_sim, cwd = CTRexScenario.scripts_path)%0A        print('Output:%5Cn%25s' %25 out)%0A        if ret:%0A            raise Exception('Non zero return status of gtests (%25s)' %25 ret)%0A%0A    def test_gtests_valgrind(self):%0A        print('')%0A        ret, out = run_command(os.path.join(CTRexScenario.scripts_path, 'run-gtest-clean'), cwd = CTRexScenario.scripts_path)%0A        print('Output:%5Cn%25s' %25 out)%0A        if ret:%0A            raise Exception('Non zero return status of Valgrind gtests (%25s)' %25 ret)%0A

add gtests as functional test