Example #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')
Example #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')
Example #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')
Example #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'])
Example #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')
Example #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')
Example #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')
Example #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')
Example #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')
Example #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')
Example #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'
                ])
Example #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')
Example #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')
Example #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')
Example #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')
Example #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')
Example #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')
Example #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')
Example #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')
Example #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')
Example #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')