예제 #1
0
    def test_set_bios_boot_mode(self):
        # test to set Legacy
        actual_result = [""]
        data = [0x0, 0x0, 0x1, 0x2, 0x3, 0x4]
        expect_result = [0x80, 0x0, 0x1, 0x2, 0x3, 0x4]
        boot_flags_valid = 1
        actual_result = get_boot_order_req_data(data, boot_flags_valid)
        self.assertEqual(actual_result, expect_result)

        # Check the bios boot_order value
        with captured_output() as (out, err):
            do_boot_order_action("get", "--boot_mode", "", data)
        output = out.getvalue().strip()
        self.assertEqual(output, "Boot Mode: Legacy")

        # test to set UEFI
        actual_result = [""]
        data = [0x1, 0x0, 0x1, 0x2, 0x3, 0x4]
        expect_result = [0x81, 0x0, 0x1, 0x2, 0x3, 0x4]
        boot_flags_valid = 1
        actual_result = get_boot_order_req_data(data, boot_flags_valid)
        self.assertEqual(actual_result, expect_result)

        # Check the bios boot_order value
        with captured_output() as (out, err):
            do_boot_order_action("get", "--boot_mode", "", data)
        output = out.getvalue().strip()
        self.assertEqual(output, "Boot Mode: UEFI")
예제 #2
0
    def test_get_bios_force_boot_BIOS_setup(self):
        get_boot_order_result = [0x1, 0x0, 0x9, 0x2, 0x3, 0x4]
        with captured_output() as (out, err):
            do_boot_order_action("get", "--force_boot_BIOS_setup", "",
                                 get_boot_order_result)
        output = out.getvalue().strip()
        self.assertEqual(output, "Force Boot to BIOS Setup Function: Disabled")

        get_boot_order_result = [0x85, 0x0, 0x9, 0x2, 0x3, 0x4]
        with captured_output() as (out, err):
            do_boot_order_action("get", "--force_boot_BIOS_setup", "",
                                 get_boot_order_result)
        output = out.getvalue().strip()
        self.assertEqual(output, "Force Boot to BIOS Setup Function: Enabled")
예제 #3
0
    def test_get_bios_clear_cmos(self):

        get_boot_order_result = [0x1, 0x0, 0x9, 0x2, 0x3, 0x4]
        with captured_output() as (out, err):
            do_boot_order_action("get", "--clear_CMOS", "",
                                 get_boot_order_result)
        output = out.getvalue().strip()
        self.assertEqual(output, "Clear CMOS Function: Disabled")

        get_boot_order_result = [0x83, 0x0, 0x9, 0x2, 0x3, 0x4]
        with captured_output() as (out, err):
            do_boot_order_action("get", "--clear_CMOS", "",
                                 get_boot_order_result)
        output = out.getvalue().strip()
        self.assertEqual(output, "Clear CMOS Function: Enabled")
예제 #4
0
    def test_get_bios_boot_mode(self):

        get_boot_order_result = [0x0, 0x0, 0x9, 0x2, 0x3, 0x4]
        with captured_output() as (out, err):
            do_boot_order_action("get", "--boot_mode", "",
                                 get_boot_order_result)
        output = out.getvalue().strip()
        self.assertEqual(output, "Boot Mode: Legacy")

        get_boot_order_result = [0x1, 0x0, 0x9, 0x2, 0x3, 0x4]
        with captured_output() as (out, err):
            do_boot_order_action("get", "--boot_mode", "",
                                 get_boot_order_result)
        output = out.getvalue().strip()
        self.assertEqual(output, "Boot Mode: UEFI")
예제 #5
0
def test_check_biosutil_usage(self, argv, test_result_file):
    with captured_output() as (out, err):
        check_bios_util(TEST_BIOS_UTIL_CONFIG, TEST_BIOS_UTIL_DEFAULT_CONFIG, argv)
    output = out.getvalue().strip()

    usage_expected_result = open(test_result_file, "r").read().strip()
    # print(usage_expected_result)  # Reserved for debugging

    self.assertEqual(output, usage_expected_result)
    def test_bios_pcie_port_config(self, sku, plat_sku_file, function, device, res_data):    
        if os.path.isfile(TEST_PCIE_PORT_CONFIG_RESULT + str(sku)):
            pcie_port_config_result = open(TEST_PCIE_PORT_CONFIG_RESULT + str(sku), 'r')
        else:
            pcie_port_config_result = "\n"

        with captured_output() as (out, err):
            self.test_pcie_port_config = do_pcie_port_config_action(plat_sku_file, function, device, res_data)
        output = out.getvalue().strip()
        self.assertEqual(output, pcie_port_config_result.read().strip())
예제 #7
0
    def test_bios_plat_info(self, sku, cmd):
        if os.path.isfile(TEST_PLAT_INFO_RESULT + str(sku)):
            plat_info_result = open(TEST_PLAT_INFO_RESULT + str(sku), "r")
        else:
            plat_info_result = "\n"

        with captured_output() as (out, err):
            self.test_plat_info = do_plat_info_action(cmd)
        output = out.getvalue().strip()
        self.assertEqual(output, plat_info_result.read().strip())
예제 #8
0
 def test_get_bios_boot_order(self):
     get_boot_order_result = [0x1, 0x0, 0x9, 0x2, 0x3, 0x4]
     with captured_output() as (out, err):
         do_boot_order_action("get", "--boot_order", "",
                              get_boot_order_result)
     output = out.getvalue().strip()
     self.assertEqual(
         output,
         "Boot Order: USB Device, IPv6 Network, SATA HDD, SATA-CDROM, Other Removable Device",
     )
예제 #9
0
    def test_bios_postcode(self):
        """
        Test Boot POST code response data is match in expectation
        """
        if os.path.isfile(TEST_POST_CODE_RESULT):
            postcode_result = open(TEST_POST_CODE_RESULT, "r")
        else:
            postcode_result = "\n"

        with captured_output() as (out, err):
            self.test_postcode = postcode("server", TEST_POST_CODE_FILE)
            self.assertTrue(self.test_postcode)
        output = out.getvalue().strip()
        self.assertEqual(output, postcode_result.read().strip())
예제 #10
0
    def test_set_bios_boot_order(self):
        actual_result = [""]
        data = [0x81, 0x0, 0x1, 0x2, 0x3, 0x4]
        expect_result = [0x81, 0x0, 0x1, 0x2, 0x3, 0x4]
        boot_flags_valid = 1
        actual_result = get_boot_order_req_data(data, boot_flags_valid)
        self.assertEqual(actual_result, expect_result)

        # Check the bios boot_order value
        with captured_output() as (out, err):
            do_boot_order_action("get", "--boot_order", "", data)
        output = out.getvalue().strip()
        self.assertEqual(
            output,
            "Boot Order: USB Device, IPv4 Network, SATA HDD, SATA-CDROM, Other Removable Device",
        )