Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Greentea] Fix test code mbed-os-tests-mbed_hal-flash #3968

Merged
merged 1 commit into from Mar 23, 2017

Conversation

ccli8
Copy link
Contributor

@ccli8 ccli8 commented Mar 20, 2017

This PR fixes the test code mbed-os-tests-mbed_hal-flash.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 20, 2017

This PR fixes the test code mbed-os-tests-mbed_hal-flash.

Thanks for the fix. how does this fixes it ? Does it fail ? With this patch it passes ?

It would be helpful to provide test results (prior and after this change). We can reproduce this locally and compare our results.

@ccli8
Copy link
Contributor Author

ccli8 commented Mar 20, 2017

@0xc0170 The issue is not met on K64F, but on my NUMAKER_PFM_NUC472 on which flash support is being added. In original mbed-os-tests-mbed_hal-flash > main.cpp > erase_range:

static void erase_range(flash_t *flash, uint32_t addr, uint32_t size)
{
    while (size > 0) {
        uint32_t sector_size = flash_get_sector_size(flash, addr);
        TEST_ASSERT_NOT_EQUAL(0, sector_size);
        int32_t ret = flash_erase_sector(flash, addr);
        TEST_ASSERT_EQUAL_INT32(0, ret);
        size = size > sector_size ? size - sector_size : 0;
    }
}

In the while loop, addr should be advanced with each iteration. On K64F, the passed in size is 0x1000 which equals its sector size, so there is only one iteration in the loop and the bug is not met. On my NUMAKER_PFM_NUC472 case, the passed in size is 0x2000 which is 4 times its sector size 0x800. There are 4 iterations in the while loop but addr is not updated.

@sg-
Copy link
Contributor

sg- commented Mar 22, 2017

/morph test-nightly

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 1716

All builds and test passed!

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 23, 2017

cc @c1728p9

@adbridge adbridge merged commit 2bf9791 into ARMmbed:master Mar 23, 2017
@ccli8 ccli8 deleted the nuvoton_ccli8 branch March 27, 2017 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants