コード例 #1
0
ファイル: file_host.py プロジェクト: wdgreen/clusterfuzz
def stat(path):
  """stat() a path."""
  request = untrusted_runner_pb2.StatRequest(path=path)
  response = host.stub().Stat(request)
  if not response.result:
    return None

  return response
コード例 #2
0
    def test_stat(self):
        """Test file_impl.stat."""
        self.fs.CreateFile('/file')
        request = untrusted_runner_pb2.StatRequest(path='/file')
        response = file_impl.stat(request, None)

        expected = os.stat('/file')
        self.assertTrue(response.result)
        self.assertEqual(expected.st_mode, response.st_mode)
        self.assertEqual(expected.st_size, response.st_size)
        self.assertEqual(expected.st_atime, response.st_atime)
        self.assertEqual(expected.st_ctime, response.st_ctime)
        self.assertEqual(expected.st_mtime, response.st_mtime)
コード例 #3
0
    def test_stat_does_not_exist(self):
        """Test file_impl.stat (does not exist)."""
        request = untrusted_runner_pb2.StatRequest(path='/file')
        response = file_impl.stat(request, None)

        self.assertFalse(response.result)