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

IOTSTOR-978: Bugfixes to TDBStore and SecureStore #11918

Merged
merged 4 commits into from Nov 28, 2019
Merged

IOTSTOR-978: Bugfixes to TDBStore and SecureStore #11918

merged 4 commits into from Nov 28, 2019

Conversation

SeppoTakalo
Copy link
Contributor

@SeppoTakalo SeppoTakalo commented Nov 21, 2019

Description

Summary of change

This is list of changes leading up to the bug fix. Many of the tests were done when exploring the issue #11862, so they logically deserve to be in this same PR.

  • Greentea: Fix storage sizes for SecureStore tests.
  • Fixes features-storage-tests-kvstore-static_tests
  • TDBStore safety check: Erase if there is valid keys on the free space.

Fixes #11862

Documentation

Need to update the documentation to remove limitation from TDBStore. It no longer requires Flash storage.


Pull request type

[X] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[X] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@VeijoPesonen


Release Notes

Summary of changes

Impact of changes

Migration actions required

@mbed-ci
Copy link

mbed-ci commented Nov 21, 2019

Test run: FAILED

Summary: 4 of 4 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_unittests
  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-IAR
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

@ciarmcom ciarmcom requested review from VeijoPesonen and a team November 21, 2019 16:00
@ciarmcom
Copy link
Member

@SeppoTakalo, thank you for your changes.
@VeijoPesonen @ARMmbed/mbed-os-storage @ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-wan @ARMmbed/mbed-os-maintainers please review.

@mbed-ci
Copy link

mbed-ci commented Nov 21, 2019

Test run: FAILED

Summary: 1 of 4 test jobs failed
Build number : 2
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_unittests

@SeppoTakalo
Copy link
Contributor Author

Rebased on top of master to fix unittest failure

Copy link
Contributor

@VeijoPesonen VeijoPesonen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@SeppoTakalo
Copy link
Contributor Author

@AnttiKauppila Can you review the mbed_assert_stub.cpp part?

features/storage/internal/utils.h Outdated Show resolved Hide resolved

#include <stdint.h>

uint32_t align_up(uint64_t val, uint64_t size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should at least contain short doxygen docs eventhough its internal

@mbed-ci
Copy link

mbed-ci commented Nov 22, 2019

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 3
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@SeppoTakalo SeppoTakalo force-pushed the IOTSTOR-978 branch 2 times, most recently from 74ed7e6 to a02db39 Compare November 22, 2019 11:11
Copy link

@AnttiKauppila AnttiKauppila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I want to knit-pick, EmulatedSD is not a stubbed class; but anyway it is just test code

@mbed-ci
Copy link

mbed-ci commented Nov 22, 2019

Test run: FAILED

Summary: 1 of 11 test jobs failed
Build number : 4
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_greentea-test

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 22, 2019

Test failures look related, please review

Is this targeting 5.15 ? We should label and needs to pass CI within this week.

@SeppoTakalo
Copy link
Contributor Author

I believe I have managed to find a bug in F411 FlashIAP implementation by introducing new test case.

[1574425934.36][CONN][RXD] >>> Running case #2: 'FLASHIAP Testing write -> deinit -> init -> read'...
[1574425934.36][CONN][INF] found KV pair in stream: {{__testcase_start;FLASHIAP Testing write -> deinit -> init -> read}}, queued...
mbedgt: :704::FAIL: Expected Not-Equal
[1574425934.43][CONN][RXD] :704::FAIL: Expected Not-Equal
[1574425934.53][CONN][RXD] >>> failure with reason 'Scheduling Asynchronous Callback Failed' during 'Unknown Location'
[1574425934.53][CONN][RXD]
[1574425934.53][CONN][RXD]
[1574425934.53][CONN][RXD] ++ MbedOS Error Info ++
[1574425934.53][CONN][RXD] Error Status: 0x80010133 Code: 307 Module: 1
[1574425934.63][CONN][RXD] Error Message: Mutex: 0x20001E68, Not allowed in ISR context
[1574425934.63][CONN][RXD] Location: 0x80068EB
[1574425934.63][CONN][RXD] Error Value: 0x20001E68
[1574425934.73][CONN][RXD] Current Thread: main Id: 0x20001618 Entry: 0x800681B StackSize: 0x1000 StackMem: 0x20001EC0 SP: 0x2001FE50
[1574425934.93][CONN][RXD] For more info, visit: https://mbed.com/s/error?error=0x80010133&osver=999999&core=0x410FC241&comp=2&ver=80300&tgt=NUCLEO_F411RE
[1574425934.93][CONN][RXD] -- MbedOS Error Info --

I'll remove the testcase from this PR and submit as a new bugreport.

@bulislaw
Copy link
Member

Can we get it in 5.15?

@mbed-ci
Copy link

mbed-ci commented Nov 25, 2019

Test run: FAILED

Summary: 3 of 4 test jobs failed
Build number : 5
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-IAR
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 25, 2019

CI was restarted

@0xc0170 0xc0170 self-requested a review November 25, 2019 11:52
@0xc0170
Copy link
Contributor

0xc0170 commented Nov 27, 2019

After adding ac99126 commit to the branch, there's a conflict with master

@SeppoTakalo SeppoTakalo force-pushed the IOTSTOR-978 branch 2 times, most recently from 9eef874 to 1be11f8 Compare November 27, 2019 20:38
@0xc0170
Copy link
Contributor

0xc0170 commented Nov 28, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Nov 28, 2019

Test run: FAILED

Summary: 2 of 4 test jobs failed
Build number : 8
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_unittests
  • jenkins-ci/mbed-os-ci_build-ARM

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 28, 2019

The unittest failures might be related to the crc that was reverted yesterday and somehow its still on this branch or?


[2019-11-28T07:33:31.902Z] libmoduletests-storage-kvstore-TDBStore.MbedOS.a(utils.cpp.o): In function `singleton_lock()':

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../platform/SingletonPtr.h:50: undefined reference to `singleton_mutex_id'

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../platform/SingletonPtr.h:54: undefined reference to `singleton_mutex_id'

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../platform/SingletonPtr.h:54: undefined reference to `osMutexAcquire'

[2019-11-28T07:33:31.902Z] libmoduletests-storage-kvstore-TDBStore.MbedOS.a(utils.cpp.o): In function `singleton_unlock()':

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../platform/SingletonPtr.h:67: undefined reference to `singleton_mutex_id'

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../platform/SingletonPtr.h:71: undefined reference to `singleton_mutex_id'

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../platform/SingletonPtr.h:71: undefined reference to `osMutexRelease'

[2019-11-28T07:33:31.902Z] libmoduletests-storage-kvstore-TDBStore.MbedOS.a(utils.cpp.o): In function `mbed::MbedCRC<79764919u, (unsigned char)32>::mbed_crc_ctor()':

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../drivers/MbedCRC.h:526: undefined reference to `hal_crc_is_supported'

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../drivers/MbedCRC.h:535: undefined reference to `mbed::Table_CRC_32bit_ANSI'

[2019-11-28T07:33:31.902Z] libmoduletests-storage-kvstore-TDBStore.MbedOS.a(utils.cpp.o): In function `mbed::MbedCRC<79764919u, (unsigned char)32>::compute_partial_start(unsigned int*)':

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../drivers/MbedCRC.h:256: undefined reference to `hal_crc_compute_partial_start'

[2019-11-28T07:33:31.902Z] libmoduletests-storage-kvstore-TDBStore.MbedOS.a(utils.cpp.o): In function `mbed::MbedCRC<79764919u, (unsigned char)32>::unlock()':

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../drivers/MbedCRC.h:342: undefined reference to `mbed::mbed_crc_mutex'

[2019-11-28T07:33:31.902Z] libmoduletests-storage-kvstore-TDBStore.MbedOS.a(utils.cpp.o): In function `mbed::MbedCRC<79764919u, (unsigned char)32>::compute_partial(void const*, unsigned long, unsigned int*)':

[2019-11-28T07:33:31.902Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../drivers/MbedCRC.h:213: undefined reference to `hal_crc_compute_partial'

[2019-11-28T07:33:31.903Z] libmoduletests-storage-kvstore-TDBStore.MbedOS.a(utils.cpp.o): In function `mbed::MbedCRC<79764919u, (unsigned char)32>::compute_partial_stop(unsigned int*)':

[2019-11-28T07:33:31.903Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../drivers/MbedCRC.h:279: undefined reference to `hal_crc_get_result'

[2019-11-28T07:33:31.903Z] libmoduletests-storage-kvstore-TDBStore.MbedOS.a(utils.cpp.o): In function `mbed::MbedCRC<79764919u, (unsigned char)32>::lock()':

[2019-11-28T07:33:31.903Z] /builds/ws/mbed-os-ci_unittests/unitTest-4559/mbed-os/UNITTESTS/../drivers/MbedCRC.h:331: undefined reference to `mbed::mbed_crc_mutex'

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 28, 2019

Ah wait, this PR is adding crc functionality to unittests, is it based on what was on master (and was reverted for 5.15) ? Please review failures

Seppo Takalo and others added 2 commits November 28, 2019 10:37
In case our are contains data from previous reset() or reset_area(),
we might  end up in the situation  where  free space contains valid
key headers,  but we have not erased that area  yet. This can cause
failures if the deinit() and init()  because  new scan of that area
would continue  as long as keys  are found. This causes keys on the
not-yet-erased  area to be included in the new instance of TDBStore.

To prevent this failure,  check  after each key-write that our free
space does not contain valid  key headers.  Also make sure  that we
erase one program unit sector over the master record.  If we erased
just the master record,first key might is still there, causing next
init() to find it.  Extend erase area by  one program unit, so that
build_ram_table() won't find any keys.
At least with LPC55S69's default TDBStore configuration it's
impossible to run storage Greentea tests without exhausting the
memory reserved for storing keys.

Fixes an issue where number of keys were removed based on number of
threads which didn't have anything to do with the test case.

Fixes an issue where number of keys were assumed to be constant
but variable number was used for configuration.
@SeppoTakalo
Copy link
Contributor Author

Wait.. I'll rework this PR into smaller chunks because it has grown too big to review.

Previously Greentea tests was not initialising its storage
before asking for bd->get_program_size(), causing FlashBlockDevice to
return zero. This caused both TDBStorage's to use zero for both
parameter to SlicingBlockDevice(bd, 0, 0), effetivaly both then
used same addresses for slice. This caused SecureStore tests
to fail, because writes to internal RBP storage overwrote keys
from external storage.

Fine-tune TDBStore sizes, so that all tests can fit into storage.
@SeppoTakalo SeppoTakalo changed the title IOTSTOR-978: Bugfixes and test coverage to TDBStore and other BlockDevices IOTSTOR-978: Bugfixes to TDBStore and SecureStore Nov 28, 2019
@mbed-ci
Copy link

mbed-ci commented Nov 28, 2019

Test run: FAILED

Summary: 4 of 4 test jobs failed
Build number : 9
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_unittests
  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-IAR
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

@mbed-ci
Copy link

mbed-ci commented Nov 28, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 10
Build artifacts

@SeppoTakalo
Copy link
Contributor Author

@0xc0170 This is now ready.

Should be able to merge into 5.15.. can go to patch release.

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.

Storage tests: kvstore-general_tests_phase_1 fails for K64F
7 participants