Debian Codegraph @

crt/aws-c-http/.builder/action/aws-c-http-test.py

raw symbols SCIP
1 import Builder
2 import sys
3 import os
4 import re
5
6
7 class AWSCHttpTest(Builder.Action):
8
9 def _export_env_var(self, filename, env):
10 with open(filename) as file:
11 pattern = re.compile("(\w+) (\w+)=(.+)")
12 for i in file.readlines():
13 match = pattern.match(i)
14 if match != None:
15 env.shell.setenv(match.groups()[1], match.groups()[2])
16 print(match.groups()[1])
17
18 def run(self, env):
19 actions = []
20 if os.path.exists('/tmp/setup_proxy_test_env.sh'):
21 # For proxy integration test, we download the setup script to tmp/ from codebuild/linux-integration-tests.yml
22 # aws s3 cp s3://aws-crt-test-stuff/setup_proxy_test_env.sh /tmp/setup_proxy_test_env.sh
23 print("setting proxy integration test environment")
24 self._export_env_var('/tmp/setup_proxy_test_env.sh', env)
25 env.shell.setenv('AWS_PROXY_NO_VERIFY_PEER', 'on')
26 if os.path.exists('./build/aws-c-http/'):
27 # This is the directory (relative to repo root) that will contain the build when the repo is built directly by the
28 # builder
29 os.chdir('./build/aws-c-http/')
30 elif os.path.exists('../../aws-c-http'):
31 # This is the directory (relative to repo root) that will contain the build when the repo is built as an upstream
32 # consumer
33 os.chdir('../../aws-c-http')
34
35 actions.append(['ctest', '--output-on-failure'])
36 # generate the test coverage report whenever possible, will be ignored by ctest if there is no test coverage data available.
37 actions.append(['ctest', '-T', 'coverage'])
38
39 return Builder.Script(actions, name='aws-c-http-test')