mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 10:45:22 +00:00
This also moves flash related tests to use new 'hostcmd' console command. BUG=chrome-os-partner:10262 TEST=Test passed BRANCH=none Change-Id: I5616bfa93bcde0beb4cb2baf2d38e8b5d827c275 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/30665 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
47 lines
1.4 KiB
Python
47 lines
1.4 KiB
Python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
#
|
|
# Flash overwrite test
|
|
#
|
|
|
|
from flash_test_util import get_flash_size
|
|
from flash_test_util import get_ro_size
|
|
from flash_test_util import test_write
|
|
import time
|
|
|
|
def test(helper):
|
|
helper.wait_output("--- UART initialized")
|
|
|
|
# Jump to RO
|
|
helper.ec_command("sysjump ro")
|
|
helper.wait_output("idle task started") # jump completed
|
|
time.sleep(0.5)
|
|
|
|
# Get flash info
|
|
flashsize = get_flash_size(helper)
|
|
rosize = get_ro_size(helper)
|
|
|
|
# We are in RO now. Writing to RO should fail.
|
|
test_write(helper, rosize / 2, 0x10, expect_fail=True)
|
|
|
|
# Writing to RW should succeed.
|
|
test_write(helper, rosize, 0x10) # begin of RW
|
|
test_write(helper, (rosize + flashsize) / 2, 0x10) # mid-point of RW
|
|
test_write(helper, flashsize - 0x10, 0x10) # end of flash
|
|
|
|
# Jump to RW-A
|
|
helper.ec_command("sysjump a")
|
|
helper.wait_output("idle task started") # jump completed
|
|
time.sleep(0.5)
|
|
|
|
# We are in RW now. Writing to RO should succeed.
|
|
test_write(helper, 0, 0x10) # begin of RO
|
|
test_write(helper, rosize / 2, 0x10) # mid-point of RO
|
|
test_write(helper, rosize - 0x10, 0x10) # end of RO
|
|
|
|
# Writing to RW-A should fail.
|
|
test_write(helper, rosize, 0x10, expect_fail=True)
|
|
|
|
return True
|