OLD | NEW |
1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 self.assertEqual('httpd seems broken. Cannot run http tests.\n', logs) | 355 self.assertEqual('httpd seems broken. Cannot run http tests.\n', logs) |
356 | 356 |
357 def test_test_exists(self): | 357 def test_test_exists(self): |
358 port = self.make_port(with_tests=True) | 358 port = self.make_port(with_tests=True) |
359 self.assertTrue(port.test_exists('passes')) | 359 self.assertTrue(port.test_exists('passes')) |
360 self.assertTrue(port.test_exists('passes/text.html')) | 360 self.assertTrue(port.test_exists('passes/text.html')) |
361 self.assertFalse(port.test_exists('passes/does_not_exist.html')) | 361 self.assertFalse(port.test_exists('passes/does_not_exist.html')) |
362 | 362 |
363 self.assertTrue(port.test_exists('virtual')) | 363 self.assertTrue(port.test_exists('virtual')) |
364 self.assertFalse(port.test_exists('virtual/does_not_exist.html')) | 364 self.assertFalse(port.test_exists('virtual/does_not_exist.html')) |
365 self.assertTrue(port.test_exists('virtual/passes/text.html')) | 365 self.assertTrue(port.test_exists('virtual/virtual_passes/passes/text.htm
l')) |
366 | 366 |
367 def test_test_isfile(self): | 367 def test_test_isfile(self): |
368 port = self.make_port(with_tests=True) | 368 port = self.make_port(with_tests=True) |
369 self.assertFalse(port.test_isfile('passes')) | 369 self.assertFalse(port.test_isfile('passes')) |
370 self.assertTrue(port.test_isfile('passes/text.html')) | 370 self.assertTrue(port.test_isfile('passes/text.html')) |
371 self.assertFalse(port.test_isfile('passes/does_not_exist.html')) | 371 self.assertFalse(port.test_isfile('passes/does_not_exist.html')) |
372 | 372 |
373 self.assertFalse(port.test_isfile('virtual')) | 373 self.assertFalse(port.test_isfile('virtual')) |
374 self.assertTrue(port.test_isfile('virtual/passes/text.html')) | 374 self.assertTrue(port.test_isfile('virtual/virtual_passes/passes/text.htm
l')) |
375 self.assertFalse(port.test_isfile('virtual/does_not_exist.html')) | 375 self.assertFalse(port.test_isfile('virtual/does_not_exist.html')) |
376 | 376 |
377 def test_test_isdir(self): | 377 def test_test_isdir(self): |
378 port = self.make_port(with_tests=True) | 378 port = self.make_port(with_tests=True) |
379 self.assertTrue(port.test_isdir('passes')) | 379 self.assertTrue(port.test_isdir('passes')) |
380 self.assertFalse(port.test_isdir('passes/text.html')) | 380 self.assertFalse(port.test_isdir('passes/text.html')) |
381 self.assertFalse(port.test_isdir('passes/does_not_exist.html')) | 381 self.assertFalse(port.test_isdir('passes/does_not_exist.html')) |
382 self.assertFalse(port.test_isdir('passes/does_not_exist/')) | 382 self.assertFalse(port.test_isdir('passes/does_not_exist/')) |
383 | 383 |
384 self.assertTrue(port.test_isdir('virtual')) | 384 self.assertTrue(port.test_isdir('virtual')) |
385 self.assertFalse(port.test_isdir('virtual/does_not_exist.html')) | 385 self.assertFalse(port.test_isdir('virtual/does_not_exist.html')) |
386 self.assertFalse(port.test_isdir('virtual/does_not_exist/')) | 386 self.assertFalse(port.test_isdir('virtual/does_not_exist/')) |
387 self.assertFalse(port.test_isdir('virtual/passes/text.html')) | 387 self.assertFalse(port.test_isdir('virtual/virtual_passes/passes/text.htm
l')) |
388 | 388 |
389 def test_tests(self): | 389 def test_tests(self): |
390 port = self.make_port(with_tests=True) | 390 port = self.make_port(with_tests=True) |
391 tests = port.tests([]) | 391 tests = port.tests([]) |
392 self.assertIn('passes/text.html', tests) | 392 self.assertIn('passes/text.html', tests) |
393 self.assertIn('virtual/passes/text.html', tests) | 393 self.assertIn('virtual/virtual_passes/passes/text.html', tests) |
394 | 394 |
395 tests = port.tests(['passes']) | 395 tests = port.tests(['passes']) |
396 self.assertIn('passes/text.html', tests) | 396 self.assertIn('passes/text.html', tests) |
397 self.assertIn('passes/passes/test-virtual-passes.html', tests) | 397 self.assertIn('passes/virtual_passes/test-virtual-passes.html', tests) |
398 self.assertNotIn('virtual/passes/text.html', tests) | 398 self.assertNotIn('virtual/virtual_passes/passes/text.html', tests) |
399 | 399 |
400 tests = port.tests(['virtual/passes']) | 400 tests = port.tests(['virtual/virtual_passes/passes']) |
401 self.assertNotIn('passes/text.html', tests) | 401 self.assertNotIn('passes/text.html', tests) |
402 self.assertIn('virtual/passes/test-virtual-passes.html', tests) | 402 self.assertIn('virtual/virtual_passes/passes/test-virtual-passes.html',
tests) |
403 self.assertIn('virtual/passes/passes/test-virtual-passes.html', tests) | 403 self.assertNotIn('passes/test-virtual-passes.html', tests) |
404 self.assertNotIn('virtual/passes/test-virtual-virtual/passes.html', test
s) | 404 self.assertNotIn('virtual/virtual_passes/passes/test-virtual-virtual/pas
ses.html', tests) |
405 self.assertNotIn('virtual/passes/virtual/passes/test-virtual-passes.html
', tests) | 405 self.assertNotIn('virtual/virtual_passes/passes/virtual_passes/passes/te
st-virtual-passes.html', tests) |
406 | 406 |
407 def test_build_path(self): | 407 def test_build_path(self): |
408 port = self.make_port(options=optparse.Values({'build_directory': '/my-b
uild-directory/'})) | 408 port = self.make_port(options=optparse.Values({'build_directory': '/my-b
uild-directory/'})) |
409 self.assertEqual(port._build_path(), '/my-build-directory/Release') | 409 self.assertEqual(port._build_path(), '/my-build-directory/Release') |
410 | 410 |
411 def test_dont_require_http_server(self): | 411 def test_dont_require_http_server(self): |
412 port = self.make_port() | 412 port = self.make_port() |
413 self.assertEqual(port.requires_http_server(), False) | 413 self.assertEqual(port.requires_http_server(), False) |
414 | 414 |
415 def test_can_load_actual_virtual_test_suite_file(self): | 415 def test_can_load_actual_virtual_test_suite_file(self): |
416 port = Port(SystemHost(), 'baseport') | 416 port = Port(SystemHost(), 'baseport') |
417 | 417 |
418 # If this call returns successfully, we found and loaded the LayoutTests
/VirtualTestSuites. | 418 # If this call returns successfully, we found and loaded the LayoutTests
/VirtualTestSuites. |
419 _ = port.virtual_test_suites() | 419 _ = port.virtual_test_suites() |
420 | 420 |
421 def test_good_virtual_test_suite_file(self): | 421 def test_good_virtual_test_suite_file(self): |
422 port = self.make_port() | 422 port = self.make_port() |
423 fs = port._filesystem | 423 fs = port._filesystem |
424 fs.write_text_file(fs.join(port.layout_tests_dir(), 'VirtualTestSuites')
, | 424 fs.write_text_file(fs.join(port.layout_tests_dir(), 'VirtualTestSuites')
, |
425 '[{"prefix": "foo", "base": "fast/foo", "args": ["--f
oo"]},' | 425 '[{"prefix": "bar", "base": "fast/bar", "args": ["--b
ar"]}]') |
426 '{"name": "bar", "base": "fast/bar", "args": ["--bar"
]}]') | |
427 | 426 |
428 # If this call returns successfully, we found and loaded the LayoutTests
/VirtualTestSuites. | 427 # If this call returns successfully, we found and loaded the LayoutTests
/VirtualTestSuites. |
429 _ = port.virtual_test_suites() | 428 _ = port.virtual_test_suites() |
430 | 429 |
431 def test_virtual_test_suite_file_is_not_json(self): | 430 def test_virtual_test_suite_file_is_not_json(self): |
432 port = self.make_port() | 431 port = self.make_port() |
433 fs = port._filesystem | 432 fs = port._filesystem |
434 fs.write_text_file(fs.join(port.layout_tests_dir(), 'VirtualTestSuites')
, | 433 fs.write_text_file(fs.join(port.layout_tests_dir(), 'VirtualTestSuites')
, |
435 '{[{[') | 434 '{[{[') |
436 self.assertRaises(ValueError, port.virtual_test_suites) | 435 self.assertRaises(ValueError, port.virtual_test_suites) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 484 |
486 class VirtualTestSuiteTest(unittest.TestCase): | 485 class VirtualTestSuiteTest(unittest.TestCase): |
487 def test_basic(self): | 486 def test_basic(self): |
488 suite = VirtualTestSuite(prefix='suite', base='base/foo', args=['--args'
]) | 487 suite = VirtualTestSuite(prefix='suite', base='base/foo', args=['--args'
]) |
489 self.assertEqual(suite.name, 'virtual/suite/base/foo') | 488 self.assertEqual(suite.name, 'virtual/suite/base/foo') |
490 self.assertEqual(suite.base, 'base/foo') | 489 self.assertEqual(suite.base, 'base/foo') |
491 self.assertEqual(suite.args, ['--args']) | 490 self.assertEqual(suite.args, ['--args']) |
492 | 491 |
493 def test_no_slash(self): | 492 def test_no_slash(self): |
494 self.assertRaises(AssertionError, VirtualTestSuite, prefix='suite/bar',
base='base/foo', args=['--args']) | 493 self.assertRaises(AssertionError, VirtualTestSuite, prefix='suite/bar',
base='base/foo', args=['--args']) |
495 | |
496 def test_legacy(self): | |
497 suite = VirtualTestSuite(name='suite/bar', base='base/foo', args=['--arg
s']) | |
498 self.assertEqual(suite.name, 'virtual/suite/bar') | |
499 self.assertEqual(suite.base, 'base/foo') | |
500 self.assertEqual(suite.args, ['--args']) | |
OLD | NEW |