Пример #1
0
    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))
Пример #2
0
    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")
Пример #3
0
    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)
Пример #4
0
    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)
Пример #5
0
 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
 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
 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
 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
 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
 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
 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
 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
 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.")
Пример #14
0
 def test_g2_config(self, mock_opt):
     mode = main._select_mode("Scheduling Events", "event",
                              vars(main._args_parse([])))
     self.assertEqual(mode, consts.DisplayOptions.G2)
Пример #15
0
 def test_g2_args(self):
     mode = main._select_mode("Scheduling Events", "event",
                              vars(main._args_parse(['-g2'])))
     self.assertEqual(mode, consts.DisplayOptions.G2)