1# Copyright (C) 2016 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15'''Module that contains the test TestRSConsts.''' 16 17from __future__ import absolute_import 18 19from harness.test_base_remote import TestBaseRemote 20from harness.decorators import ( 21 ordered_test, 22 cpp_only_test, 23) 24 25 26class TestRSConsts(TestBaseRemote): 27 '''Tests examining the RenderScript constants.''' 28 29 bundle_target = { 30 'java': 'KernelVariables', 31 'jni': 'JNIKernelVariables', 32 'cpp': 'CppKernelVariables' 33 } 34 35 def test_rs_consts(self): 36 self.try_command('language renderscript status', 37 ['Runtime Library discovered', 38 'Runtime Driver discovered']) 39 40 self.try_command('language renderscript kernel breakpoint set kernel', 41 []) 42 43 self.try_command('process continue', 44 ['resuming', 45 'stopped', 46 'stop reason = breakpoint']) 47 48 # Constants 49 self.try_command('expr M_1_PI', 50 ['0.318309']) 51 52 self.try_command('expr M_2_PI', 53 ['0.636619']) 54 55 self.try_command('expr M_2_SQRTPI', 56 ['1.128379']) 57 58 self.try_command('expr M_E', 59 ['2.718281']) 60 61 self.try_command('expr M_LN10', 62 ['2.302585']) 63 64 self.try_command('expr M_LN2', 65 ['0.693147']) 66 67 self.try_command('expr M_LOG10E', 68 ['0.434294']) 69 70 self.try_command('expr M_LOG2E', 71 ['1.442695']) 72 73 self.try_command('expr M_PI', 74 ['3.141592']) 75 76 self.try_command('expr M_PI_2', 77 ['1.570796']) 78 79 self.try_command('expr M_PI_4', 80 ['0.785398']) 81 82 self.try_command('expr M_SQRT1_2', 83 ['0.707106']) 84 85 self.try_command('expr M_SQRT2', 86 ['1.414213']) 87 88 @ordered_test('last') 89 @cpp_only_test() 90 def test_cpp_cleanup(self): 91 self.try_command('breakpoint delete 1', ['1 breakpoints deleted']) 92 93 self.try_command('process continue', ['exited with status = 0']) 94 95