aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils/env.py
blob: d7b396eaa11b4cd7b16800d1b023042e7c86bbb3 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python

import pkg_resources
import os
import re

import six


default_envs = {
    'NODE_NAME': 'unknown_pod',
    'CI_DEBUG': 'false',
    'DEPLOY_SCENARIO': 'os-nosdn-nofeature-noha',
    'DEPLOY_TYPE': 'virt',
    'INSTALLER_TYPE': None,
    'INSTALLER_IP': None,
    'BUILD_TAG': None,
    'OS_ENDPOINT_TYPE': None,
    'OS_AUTH_URL': None,
    'CONFIG_FUNCTEST_YAML': pkg_resources.resource_filename(
        'functest', 'ci/config_functest.yaml'),
    'OS_INSECURE': ''
}


class Environment(object):

    def __init__(self):
        for k, v in six.iteritems(os.environ):
            self.__setattr__(k, v)
        for k, v in six.iteritems(default_envs):
            if k not in os.environ:
                self.__setattr__(k, v)
        self._set_ci_run()
        if 'CI_LOOP' not in os.environ:
            self._set_ci_loop()

    def _set_ci_run(self):
        if self.BUILD_TAG:
            self.IS_CI_RUN = True
        else:
            self.IS_CI_RUN = False

    def _set_ci_loop(self):
        if self.BUILD_TAG and re.search("daily", self.BUILD_TAG):
            self.CI_LOOP = "daily"
        else:
            self.CI_LOOP = "weekly"


ENV = Environment()
n">l, ibuf[i].l); OP (obuf[i].r, ibuf[i].r); } *isamp = n; *osamp = n; return; } while (obuf < oend) { /* Safety catch to make sure we have input samples. */ if (ibuf >= iend) { break; } /* read as many input samples so that ipos > opos */ while (rate->ipos <= (rate->opos >> 32)) { ilast = *ibuf++; rate->ipos++; /* See if we finished the input buffer yet */ if (ibuf >= iend) { goto the_end; } } icur = *ibuf; /* interpolate */ #ifdef FLOAT_MIXENG #ifdef RECIPROCAL t = (rate->opos & UINT_MAX) * (1.f / UINT_MAX); #else t = (rate->opos & UINT_MAX) / (mixeng_real) UINT_MAX; #endif out.l = (ilast.l * (1.0 - t)) + icur.l * t; out.r = (ilast.r * (1.0 - t)) + icur.r * t; #else t = rate->opos & 0xffffffff; out.l = (ilast.l * ((int64_t) UINT_MAX - t) + icur.l * t) >> 32; out.r = (ilast.r * ((int64_t) UINT_MAX - t) + icur.r * t) >> 32; #endif /* output sample & increment position */ OP (obuf->l, out.l); OP (obuf->r, out.r); obuf += 1; rate->opos += rate->opos_inc; } the_end: *isamp = ibuf - istart; *osamp = obuf - ostart; rate->ilast = ilast; } #undef NAME #undef OP