1#!/usr/bin/env python3 2# 3# Copyright (C) 2016 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); you may not 6# use this file except in compliance with the License. You may obtain a copy of 7# 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, WITHOUT 13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14# License for the specific language governing permissions and limitations under 15# the License. 16 17from acts.base_test import BaseTestClass 18 19 20class Sl4aSanityTest(BaseTestClass): 21 """Tests for sl4a basic sanity. 22 23 Run these tests individually with option -r 100. 24 """ 25 26 def __init__(self, controllers): 27 BaseTestClass.__init__(self, controllers) 28 self.tests = ("test_bring_up_and_shutdown", 29 "test_message_then_shutdown_stress") 30 31 def test_bring_up_and_shutdown(self): 32 """Constantly start and terminate sl4a sessions. 33 34 Verify in log that the "manager map key" is always empty before a 35 session starts. 36 Verify in log by looking at timestamps that after the test finishes, no 37 more message regarding sl4a happens. 38 """ 39 ad = self.android_devices[0] 40 for i in range(100): 41 self.log.info("Iteration %d, terminating." % i) 42 ad.terminate_all_sessions() 43 self.log.info("Iteration %d, starting." % i) 44 droid, ed = ad.get_droid() 45 return True 46