Home | History | Annotate | Download | only in sl4a_lib
      1 #!/usr/bin/env python3
      2 #
      3 #   Copyright 2018 - The Android Open Source Project
      4 #
      5 #   Licensed under the Apache License, Version 2.0 (the "License");
      6 #   you may not use this file except in compliance with the License.
      7 #   You may obtain a copy of the License at
      8 #
      9 #       http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 #   Unless required by applicable law or agreed to in writing, software
     12 #   distributed under the License is distributed on an "AS IS" BASIS,
     13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 #   See the License for the specific language governing permissions and
     15 #   limitations under the License.
     16 
     17 import sys
     18 import unittest
     19 
     20 from tests.controllers.sl4a_lib import rpc_client_test
     21 from tests.controllers.sl4a_lib import rpc_connection_test
     22 from tests.controllers.sl4a_lib import sl4a_manager_test
     23 from tests.controllers.sl4a_lib import sl4a_session_test
     24 
     25 
     26 def compile_suite():
     27     test_classes_to_run = [
     28         rpc_client_test.RpcClientTest,
     29         rpc_connection_test.RpcConnectionTest,
     30         sl4a_manager_test.Sl4aManagerFactoryTest,
     31         sl4a_manager_test.Sl4aManagerTest,
     32         sl4a_session_test.Sl4aSessionTest,
     33     ]
     34     loader = unittest.TestLoader()
     35 
     36     suites_list = []
     37     for test_class in test_classes_to_run:
     38         suite = loader.loadTestsFromTestCase(test_class)
     39         suites_list.append(suite)
     40 
     41     big_suite = unittest.TestSuite(suites_list)
     42     return big_suite
     43 
     44 
     45 if __name__ == "__main__":
     46     # This is the entry point for running all SL4A Lib unit tests.
     47     runner = unittest.TextTestRunner()
     48     results = runner.run(compile_suite())
     49     sys.exit(not results.wasSuccessful())
     50