Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / tools / swarming_client / tests / swarming_smoke_test.py
1 #!/usr/bin/env python
2 # Copyright 2013 The Swarming Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 that
4 # can be found in the LICENSE file.
5
6 import logging
7 import os
8 import subprocess
9 import sys
10 import unittest
11
12 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
13
14 ISOLATE_SERVER = 'https://isolateserver.appspot.com/'
15 SWARMING_SERVER = 'https://chromium-swarm.appspot.com/'
16
17
18 class TestSwarm(unittest.TestCase):
19   def test_example(self):
20     # pylint: disable=W0101
21     # A user should be able to trigger a swarm job and return results.
22     cmd = [
23       sys.executable,
24       '4_swarming_trigger_collect.py',
25       '--isolate-server', ISOLATE_SERVER,
26       '--swarming', SWARMING_SERVER,
27     ]
28     if '-v' in sys.argv:
29       cmd.append('--verbose')
30     p = subprocess.Popen(
31         cmd,
32         cwd=os.path.join(BASE_DIR, '..', 'example'),
33         stdin=subprocess.PIPE,
34         stdout=subprocess.PIPE,
35         stderr=subprocess.STDOUT)
36     out = p.communicate()[0]
37     logging.debug(out)
38     self.assertEqual(0, p.returncode, out)
39
40
41 if __name__ == '__main__':
42   logging.basicConfig(
43       level=logging.DEBUG if '-v' in sys.argv else logging.ERROR)
44   if '-v' in sys.argv:
45     unittest.TestCase.maxDiff = None
46   unittest.main()