Exemple #1
0
    def test_default(self):
        """ run parser: backend final fallback path """
        self._unset_config()
        self._move_piglit_conf()

        args = run._run_parser(['quick.py', 'foo'])
        nt.assert_equal(args.backend, 'json')
Exemple #2
0
    def test_default(self):
        """ run parser: backend final fallback path """
        self._unset_config()
        self._move_piglit_conf()

        args = run._run_parser(['quick.py', 'foo'])
        nt.assert_equal(args.backend, 'json')
Exemple #3
0
    def test_default(self):
        """ run parser: platform final fallback path """
        self._unset_config()
        self._move_piglit_conf()

        args = run._run_parser(['quick.py', 'foo'])
        nt.assert_equal(args.platform, 'mixed_glx_egl')
Exemple #4
0
    def test_bad_value_in_conf(self):
        """ run parser: an error is raised when the platform in conf is bad """
        self._unset_config()
        self._move_piglit_conf()

        # This has sideffects, it shouldn't effect anything in this module, but
        # it may cause later problems. But without this we get ugly error spew
        # from this test.
        sys.stderr = open(os.devnull, 'w')

        with utils.tempdir() as tdir:
            with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
                f.write('[core]\nplatform=foobar')

            run._run_parser(['-f', os.path.join(tdir, 'piglit.conf'),
                             'quick.py', 'foo'])
Exemple #5
0
    def test_env_no_options(self):
        """ Run parser: When no platform is passed env overrides default
        """
        self.__set_env()

        args = run._run_parser(['quick.py', 'foo'])
        nt.assert_equal(args.platform, 'glx')
Exemple #6
0
    def test_env_no_options(self):
        """ Run parser: When no platform is passed env overrides default
        """
        self.__set_env()

        args = run._run_parser(['quick.py', 'foo'])
        nt.assert_equal(args.platform, 'glx')
Exemple #7
0
    def test_default(self):
        """ run parser: platform final fallback path """
        self._unset_config()
        self._move_piglit_conf()

        args = run._run_parser(['quick.py', 'foo'])
        nt.assert_equal(args.platform, 'mixed_glx_egl')
Exemple #8
0
    def test_option_conf(self):
        """ Run parser: backend option replaces conf """
        with utils.tempdir() as tdir:
            os.environ['XDG_CONFIG_HOME'] = tdir
            with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
                f.write(self._CONF)

            args = run._run_parser(['-b', 'json', 'quick.py', 'foo'])
            nt.assert_equal(args.backend, 'json')
Exemple #9
0
    def test_option_conf(self):
        """ Run parser: platform option replaces conf """
        with utils.tempdir() as tdir:
            os.environ['XDG_CONFIG_HOME'] = tdir
            with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
                f.write(self._CONF)

            args = run._run_parser(['-p', 'x11_egl', 'quick.py', 'foo'])
            nt.assert_equal(args.platform, 'x11_egl')
Exemple #10
0
    def test_option_conf(self):
        """ Run parser: platform option replaces conf """
        with utils.nose.tempdir() as tdir:
            os.environ['XDG_CONFIG_HOME'] = tdir
            with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
                f.write(self._CONF)

            args = run._run_parser(['-p', 'x11_egl', 'quick.py', 'foo'])
            nt.assert_equal(args.platform, 'x11_egl')
Exemple #11
0
    def test_bad_value_in_conf(self):
        """ run parser: an error is raised when the platform in conf is bad """
        self._unset_config()
        self._move_piglit_conf()

        # This has sideffects, it shouldn't effect anything in this module, but
        # it may cause later problems. But without this we get ugly error spew
        # from this test.
        sys.stderr = open(os.devnull, 'w')

        with utils.tempdir() as tdir:
            with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
                f.write('[core]\nplatform=foobar')

            with nt.assert_raises(SystemExit):
                run._run_parser([
                    '-f',
                    os.path.join(tdir, 'piglit.conf'), 'quick.py', 'foo'
                ])
Exemple #12
0
    def test_conf_default(self):
        """ Run parser platform: conf is used as a default when applicable """
        self._unset_config()
        self._move_piglit_conf()

        with utils.tempdir() as tdir:
            os.environ['XDG_CONFIG_HOME'] = tdir
            with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
                f.write(self._CONF)

            args = run._run_parser(['quick.py', 'foo'])
            nt.assert_equal(args.backend, 'junit')
Exemple #13
0
    def test_conf_default(self):
        """ Run parser platform: conf is used as a default when applicable """
        self._unset_config()
        self._move_piglit_conf()

        with utils.tempdir() as tdir:
            os.environ['XDG_CONFIG_HOME'] = tdir
            with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
                f.write(self._CONF)

            args = run._run_parser(['quick.py', 'foo'])
            nt.assert_equal(args.platform, 'gbm')
Exemple #14
0
    def test_env_conf(self):
        """ Run parser: env overwrides a conf value """
        self._unset_config()
        self._move_piglit_conf()
        self.__set_env()

        with utils.tempdir() as tdir:
            os.environ['XDG_CONFIG_HOME'] = tdir
            with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
                f.write(self._CONF)

            args = run._run_parser(['quick.py', 'foo'])
            nt.assert_equal(args.platform, 'glx')
Exemple #15
0
    def test_env_conf(self):
        """ Run parser: env overwrides a conf value """
        self._unset_config()
        self._move_piglit_conf()
        self.__set_env()

        with utils.tempdir() as tdir:
            os.environ['XDG_CONFIG_HOME'] = tdir
            with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
                f.write(self._CONF)

            args = run._run_parser(['quick.py', 'foo'])
            nt.assert_equal(args.platform, 'glx')
Exemple #16
0
 def test_option_default(self):
     """ Run parser: platform replaces default """
     args = run._run_parser(['-p', 'x11_egl', 'quick.py', 'foo'])
     nt.assert_equal(args.platform, 'x11_egl')
Exemple #17
0
    def test_option_env(self):
        """ Run parser: platform option replaces env """
        self.__set_env()

        args = run._run_parser(['-p', 'x11_egl', 'quick.py', 'foo'])
        nt.assert_equal(args.platform, 'x11_egl')
Exemple #18
0
    def test_option_env(self):
        """ Run parser: platform option replaces env """
        self.__set_env()

        args = run._run_parser(['-p', 'x11_egl', 'quick.py', 'foo'])
        nt.assert_equal(args.platform, 'x11_egl')
Exemple #19
0
 def test_option_default(self):
     """ Run parser: platform replaces default """
     args = run._run_parser(['-p', 'x11_egl', 'quick.py', 'foo'])
     nt.assert_equal(args.platform, 'x11_egl')
Exemple #20
0
 def test_option_default(self):
     """ Run parser: backend replaces default """
     args = run._run_parser(['-b', 'json', 'quick.py', 'foo'])
     nt.assert_equal(args.backend, 'json')
Exemple #21
0
 def test_option_default(self):
     """ Run parser: backend replaces default """
     args = run._run_parser(['-b', 'json', 'quick.py', 'foo'])
     nt.assert_equal(args.backend, 'json')