コード例 #1
0
ファイル: test_main.py プロジェクト: sattishv/marple
    def test_invalid_interface_but_correct_mode(self):
        """
        Even though we have an invalid interface, since we have a cmd line
        argument that is consistent with the datatype, the answer is correct
        """

        mode = main._select_mode("INVALID", "event",
                                 vars(main._args_parse(["-g2"])))
        self.assertEqual(mode, consts.DisplayOptions.G2)
コード例 #2
0
ファイル: test_main.py プロジェクト: sattishv/marple
    def test_invalid_arg_but_valid_config(self, mock_opt):
        """
        We call the select with an invalid arg for the datatype, but it will
        not trigger errors since we default it to the value from the config
        Covers all such test cases
        """

        mode = main._select_mode("Scheduling Events", "event",
                                 vars(main._args_parse(["-fg"])))
        self.assertEqual(mode, consts.DisplayOptions.G2)
コード例 #3
0
ファイル: test_main.py プロジェクト: sattishv/marple
    def test_invalid_default(self, mock_opt):
        """
        If the default value from the config is invalid, throw error

        """
        with self.assertRaises(ValueError) as ve:
            main._select_mode("Scheduling Events", "event",
                              vars(main._args_parse([])))
        err = ve.exception
        self.assertEqual(
            "The default value from the config (random) was not recognised. "
            "Make sure the config values are within the accepted parameters.",
            str(err))
コード例 #4
0
ファイル: test_main.py プロジェクト: sattishv/marple
    def test_invalid_(self, mock_opt):
        """
        If the default value from the config is valid but not supported by the
        file

        """
        with self.assertRaises(ValueError) as ve:
            main._select_mode("Scheduling Events", "event",
                              vars(main._args_parse([])))
        err = ve.exception
        self.assertEqual(
            str(err), "No valid args or config values found for "
            "Scheduling Events. Either add an arg in the terminal "
            "command or modify the config file")
コード例 #5
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_sp_config(self, mock_opt):
     mode = main._select_mode("Memory/Time", "point",
                              vars(main._args_parse([])))
     self.assertEqual(mode, consts.DisplayOptions.STACKPLOT)
コード例 #6
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_sp_args(self):
     mode = main._select_mode("Memory/Time", "point",
                              vars(main._args_parse(['-sp'])))
     self.assertEqual(mode, consts.DisplayOptions.STACKPLOT)
コード例 #7
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_fg_config(self, mock_opt):
     mode = main._select_mode("Call Stacks", "stack",
                              vars(main._args_parse([])))
     self.assertEqual(mode, consts.DisplayOptions.FLAMEGRAPH)
コード例 #8
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_fg_args(self):
     mode = main._select_mode("Call Stacks", "stack",
                              vars(main._args_parse(['-fg'])))
     self.assertEqual(mode, consts.DisplayOptions.FLAMEGRAPH)
コード例 #9
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_tm_config(self, mock_opt):
     mode = main._select_mode("Malloc Stacks", "stack",
                              vars(main._args_parse([])))
     self.assertEqual(mode, consts.DisplayOptions.TREEMAP)
コード例 #10
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_tm_args(self):
     mode = main._select_mode("Malloc Stacks", "stack",
                              vars(main._args_parse(['-tm'])))
     self.assertEqual(mode, consts.DisplayOptions.TREEMAP)
コード例 #11
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_hm_config(self, mock_opt):
     mode = main._select_mode("Disk Latency/Time", "point",
                              vars(main._args_parse([])))
     self.assertEqual(mode, consts.DisplayOptions.HEATMAP)
コード例 #12
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_hm_args(self):
     mode = main._select_mode("Disk Latency/Time", "point",
                              vars(main._args_parse(['-hm'])))
     self.assertEqual(mode, consts.DisplayOptions.HEATMAP)
コード例 #13
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_args_normal(self):
     args = ['-fg', '-i', 'test.in']
     args = main._args_parse(args)
     self.assertTrue(args.flamegraph)
     self.assertEqual(args.infile, 'test.in')
コード例 #14
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_datatype_not_supported(self):
     with self.assertRaises(ValueError) as ve:
         main._select_mode("RANDOM", "RANDOM", vars(main._args_parse([])))
     err = ve.exception
     self.assertEqual(str(err), "The datatype RANDOM is not supported.")
コード例 #15
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_g2_config(self, mock_opt):
     mode = main._select_mode("Scheduling Events", "event",
                              vars(main._args_parse([])))
     self.assertEqual(mode, consts.DisplayOptions.G2)
コード例 #16
0
ファイル: test_main.py プロジェクト: sattishv/marple
 def test_g2_args(self):
     mode = main._select_mode("Scheduling Events", "event",
                              vars(main._args_parse(['-g2'])))
     self.assertEqual(mode, consts.DisplayOptions.G2)