Beispiel #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))
Beispiel #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")
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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.")
Beispiel #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)
Beispiel #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)