예제 #1
0
 def ListTests(self, current_path, path, mode, variant_flags):
     executable = 'cctest'
     if utils.IsWindows():
         executable += '.exe'
     executable = join(self.context.buildspace, executable)
     if not exists(executable):
         executable = join('obj', 'test', mode, 'cctest')
         if utils.IsWindows():
             executable += '.exe'
         executable = join(self.context.buildspace, executable)
     full_command = self.context.processor([executable, '--list'])
     output = test.Execute(full_command, self.context)
     if output.exit_code != 0:
         print output.stdout
         print output.stderr
         return []
     result = []
     for test_desc in output.stdout.strip().split():
         raw_test, dependency = test_desc.split('<')
         relative_path = raw_test.split('/')
         full_path = current_path + relative_path
         if dependency != '':
             dependency = relative_path[0] + '/' + dependency
         if self.Contains(path, full_path):
             result.append(
                 CcTestCase(full_path, executable, mode, raw_test,
                            dependency, self.context, variant_flags))
     result.sort()
     return result
예제 #2
0
 def RunCommand(self, command, env):
     full_command = self.context.processor(command)
     output = test.Execute(full_command, self.context,
                           self.context.GetTimeout(self.mode), env, True)
     self.Cleanup()
     return test.TestOutput(self, full_command, output,
                            self.context.store_unexpected_output)
예제 #3
0
 def RunCommand(self, command, env):
     input = None
     if self.input is not None and exists(self.input):
         input = open(self.input).read()
     full_command = self.context.processor(command)
     output = test.Execute(full_command,
                           self.context,
                           self.context.GetTimeout(self.mode),
                           env,
                           faketty=True,
                           input=input)
     return test.TestOutput(self, full_command, output,
                            self.context.store_unexpected_output)
예제 #4
0
 def RunCommand(self, command, env):
     fd = None
     if self.input is not None and exists(self.input):
         fd = os.open(self.input, os.O_RDONLY)
     full_command = self.context.processor(command)
     full_command = [sys.executable, PTY_HELPER] + full_command
     output = test.Execute(full_command,
                           self.context,
                           self.context.GetTimeout(self.mode),
                           env,
                           stdin=fd)
     if fd is not None:
         os.close(fd)
     return test.TestOutput(self, full_command, output,
                            self.context.store_unexpected_output)
예제 #5
0
 def ListTests(self, current_path, path, mode):
     executable = join('obj', 'test', mode, 'cctest')
     if (platform.system() == 'Windows'):
         executable += '.exe'
     output = test.Execute([executable, '--list'], self.context)
     if output.exit_code != 0:
         print output.stdout
         print output.stderr
         return []
     result = []
     for raw_test in output.stdout.strip().split():
         full_path = current_path + raw_test.split('/')
         if self.Contains(path, full_path):
             result.append(
                 CcTestCase(full_path, executable, mode, raw_test,
                            self.context))
     return result
예제 #6
0
 def ListTests(self, current_path, path, mode):
   executable = join('obj', 'test', mode, 'cctest')
   if utils.IsWindows():
     executable += '.exe'
   output = test.Execute([executable, '--list'], self.context)
   if output.exit_code != 0:
     print output.stdout
     print output.stderr
     return []
   result = []
   for test_desc in output.stdout.strip().split():
     raw_test, dependency = test_desc.split('<')
     relative_path = raw_test.split('/')
     full_path = current_path + relative_path
     if dependency != '':
       dependency = relative_path[0] + '/' + dependency
     if self.Contains(path, full_path):
       result.append(CcTestCase(full_path, executable, mode, raw_test, dependency, self.context))
   return result