Esempio n. 1
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)
Esempio n. 2
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)
Esempio n. 3
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))
Esempio n. 4
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")
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 13
0
 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')
Esempio n. 14
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.")
Esempio n. 15
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)
Esempio n. 16
0
 def test_g2_args(self):
     mode = main._select_mode("Scheduling Events", "event",
                              vars(main._args_parse(['-g2'])))
     self.assertEqual(mode, consts.DisplayOptions.G2)