test_CLITool_AzTestRunner_Works.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. """
  2. Copyright (c) Contributors to the Open 3D Engine Project.
  3. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. SPDX-License-Identifier: Apache-2.0 OR MIT
  5. CLI tool - AzTestRunner
  6. Launch AzTestRunner and Verify the help message
  7. """
  8. import os
  9. import pytest
  10. import subprocess
  11. import ly_test_tools
  12. @pytest.mark.SUITE_smoke
  13. class TestCLIToolAzTestRunnerWorks(object):
  14. def test_CLITool_AzTestRunner_ListSelfTests(self, build_directory):
  15. file_path = os.path.join(build_directory, "AzTestRunner")
  16. help_message = "OKAY Symbol found: AzRunUnitTests"
  17. if ly_test_tools.WINDOWS:
  18. target_lib = "AzTestRunner.Tests"
  19. else:
  20. target_lib = "libAzTestRunner.Tests"
  21. # Launch AzTestRunner, load self-tests, print test names
  22. output = subprocess.run(
  23. [file_path, target_lib, "AzRunUnitTests", "--gtest_list_tests"], capture_output=True, timeout=10
  24. )
  25. assert (
  26. len(output.stderr) == 0 and output.returncode == 0
  27. ), f"Error occurred while launching {file_path}: {output.stderr}"
  28. # Verify help message
  29. assert help_message in str(output.stdout), f"Help Message: '{help_message}' unexpectedly not present"