File: aws-c-http-test.py

package info (click to toggle)
aws-crt-python 0.20.4%2Bdfsg-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 72,656 kB
  • sloc: ansic: 381,805; python: 23,008; makefile: 6,251; sh: 4,536; cpp: 699; ruby: 208; java: 77; perl: 73; javascript: 46; xml: 11
file content (39 lines) | stat: -rw-r--r-- 1,769 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import Builder
import sys
import os
import re


class AWSCHttpTest(Builder.Action):

    def _export_env_var(self, filename, env):
        with open(filename) as file:
            pattern = re.compile("(\w+) (\w+)=(.+)")
            for i in file.readlines():
                match = pattern.match(i)
                if match != None:
                    env.shell.setenv(match.groups()[1], match.groups()[2])
                    print(match.groups()[1])

    def run(self, env):
        actions = []
        if os.path.exists('/tmp/setup_proxy_test_env.sh'):
            # For proxy integration test, we download the setup script to tmp/ from codebuild/linux-integration-tests.yml
            # aws s3 cp s3://aws-crt-test-stuff/setup_proxy_test_env.sh /tmp/setup_proxy_test_env.sh
            print("setting proxy integration test environment")
            self._export_env_var('/tmp/setup_proxy_test_env.sh', env)
            env.shell.setenv('AWS_PROXY_NO_VERIFY_PEER', 'on')
        if os.path.exists('./build/aws-c-http/'):
            # This is the directory (relative to repo root) that will contain the build when the repo is built directly by the
            # builder
            os.chdir('./build/aws-c-http/')
        elif os.path.exists('../../aws-c-http'):
            # This is the directory (relative to repo root) that will contain the build when the repo is built as an upstream
            # consumer
            os.chdir('../../aws-c-http')

        actions.append(['ctest', '--output-on-failure'])
        # generate the test coverage report whenever possible, will be ignored by ctest if there is no test coverage data available.
        actions.append(['ctest', '-T', 'coverage'])

        return Builder.Script(actions, name='aws-c-http-test')