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

tests/riotboot_flashwrite: add python test script #11808

Closed
wants to merge 10 commits into from

Conversation

fjmolinas
Copy link
Contributor

@fjmolinas fjmolinas commented Jul 5, 2019

Contribution description

This PR adds a test script for riotboot_flashwrite. It it still missing a lot of dependencies PR's from @kaspar030.

NOTE: the autthorship in the first 6 commits is only @kaspar030 it's a residue of cherry-pick.

Testing procedure

Follow the README and test over ethos and wireless.

Issues/PRs references

Depends on #11707, #11690 and #11816.

@fjmolinas fjmolinas added Area: tests Area: tests and testing framework State: waiting for other PR State: The PR requires another PR to be merged first Area: OTA Area: Over-the-air updates labels Jul 5, 2019
@fjmolinas fjmolinas force-pushed the pr_riotboot_flashwrite_test branch from e2af9cc to b74417c Compare July 8, 2019 12:13
@fjmolinas fjmolinas force-pushed the pr_riotboot_flashwrite_test branch from b74417c to 48468bb Compare July 15, 2019 15:08
@fjmolinas fjmolinas removed the State: waiting for other PR State: The PR requires another PR to be merged first label Jul 15, 2019
@fjmolinas fjmolinas force-pushed the pr_riotboot_flashwrite_test branch 5 times, most recently from 46f4285 to b05e98b Compare July 15, 2019 16:14
@fjmolinas
Copy link
Contributor Author

@kaspar030 there are no dependencies anymore!

@fjmolinas fjmolinas force-pushed the pr_riotboot_flashwrite_test branch 2 times, most recently from 5033f8e to f267f5f Compare July 15, 2019 18:25
Copy link
Contributor

@kaspar030 kaspar030 left a comment

Choose a reason for hiding this comment

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

Having the suit testing in the queue, which implicitly tests riotboot_flashwrite, does it make sense to have another test application?

@@ -1,6 +1,8 @@
DEVELHELP ?= 0
# If no BOARD is found in the environment, use this default:
Copy link
Contributor

Choose a reason for hiding this comment

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

tests usually include ../Makefile.tests_common.
That sets BOARD and DEVELHELP to defaults, and also configures the application name to something that cannot clash. As is, this application would be called riotboot_flashwrite, same as the module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is still included I just moved it to the bottom. The first commit only does that, to group things better (although that is just my personal taste I guess), but I can always drop that commit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahok. Then please move it back to the top, for consistency. Just put the variables that override it above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@fjmolinas
Copy link
Contributor Author

fjmolinas commented Jul 16, 2019

Having the suit testing in the queue, which implicitly tests riotboot_flashwrite, does it make sense to have another test application?

IMO although suit implicitly tests riotboot_flashwrite, having an explicit test is better. Tests that cover specific or smaller building block are needed even if there is an integration test that covers the whole system. Following that argument why would I have a test for sx1276 when semtech_loramac already tests that. If I'm testing suit for a platform if see the test fails I can go back on the building blocks, does tests/riotboot succeed? does tests/riotboot_flashwrite succeed? IMO being able to isolate things helps with testing and finding bugs.

Also, although suit attempts to be a standard, it might not be used, people might still implement there own OTA mechanism, because they want something smaller/simplet, or because they think having something privative is more secure (I'm not stating an opinion here), or whatever reason. I think saying a suit test is enough is presuming on what a user or developer might want to do with riotboot_flashwrite or riotboot.

I also think that running tests/riotboot_flashwrite should be part of the standard testing a user does when implementing riotboot for a board (if it supports it). tests/riotboot could succeed and tests/riotboot_flashwrite fail because of alignment issues between the slots/bootloader and the flashpage_size, etc.

And as a developer I find it useful do have an automatic script I can launch whenever I change riotboot_flashwrite (completely biased opinion :) ). EDIT: and makes review process easier for the reviewer.

@kaspar030
Copy link
Contributor

BTW, if you'd like to test just this test on murdock without rebuilding, you can add a "REMOVEME" commit that adds a filter to "./.murdock", somewhere at the top:

BOARDS=samr21-xpro
APPS=tests/riotboot_flashwrite

That should limit the build to that one application/board.

@kaspar030
Copy link
Contributor

And as a developer I find it useful do have an automatic script I can launch whenever I change riotboot_flashwrite (completely biased opinion :) ).

OK! (I just saw like 80% duplication in Makefile and test...)

@kaspar030
Copy link
Contributor

(I just saw like 80% duplication in Makefile and test...)

(and the flash/reflash tests over network block the board for >two minutes, compared to ~20sec for a regular test)

@fjmolinas
Copy link
Contributor Author

(and the flash/reflash tests over network block the board for >two minutes, compared to ~20sec for a regular test)

OK! (I just saw like 80% duplication in Makefile and test...)

Yes I know... :( maybe the solution could be to modify the suit test.. so it proceeds with the update even if some part of suit verification fails? The test scipt would fail but only on the suit part and not the flashwrite part?

@fjmolinas
Copy link
Contributor Author

BTW, if you'd like to test just this test on murdock without rebuilding, you can add a "REMOVEME" commit that adds a filter to "./.murdock", somewhere at the top:

BOARDS=samr21-xpro
APPS=tests/riotboot_flashwrite
That should limit the build to that one application/board.

Cool! Thanks!

Copy link
Contributor

@aabadie aabadie 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 but would need a rebase to get the latest development made in the test scripts behavior recently (test_interactive_sync).

# create final binaries with specific APP_VER values. The CI RasPi test workers
# don't compile themselves, thus add the required files here so they will be
# submitted along with the test jobs.
TEST_EXTRA_FILES=$(SLOT_RIOT_ELFS)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
TEST_EXTRA_FILES=$(SLOT_RIOT_ELFS)
TEST_EXTRA_FILES = $(SLOT_RIOT_ELFS)

printf("Current slot=%d\n", current_slot);
riotboot_slot_print_hdr(current_slot);
if (current_slot != -1) {
/* Sometimes, udhcp output messes up the following printfs. That
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/* Sometimes, udhcp output messes up the following printfs. That
/* Sometimes, udhcp output messes up the following printfs. That

"-b",
"64",
]
subprocess.Popen(cmd, cwd=BINDIR)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not :

Suggested change
subprocess.Popen(cmd, cwd=BINDIR)
subprocess.call(cmd, cwd=BINDIR)

?
with eventually the use of an assert.

"""For one board test if specified application is updatable"""

# Initial Setup and wait for address configuration
child.expect_exact("main(): This is RIOT!")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not needed now with the test_interactive_sync module.

@fjmolinas
Copy link
Contributor Author

Rebased but there are some issue with the script will address later.

@stale
Copy link

stale bot commented Jul 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Jul 17, 2020
@aabadie
Copy link
Contributor

aabadie commented Jul 17, 2020

still useful but might need a refresh

@stale stale bot removed the State: stale State: The issue / PR has no activity for >185 days label Jul 17, 2020
@fjmolinas
Copy link
Contributor Author

Staled, doesn't work anymore.

@fjmolinas fjmolinas closed this Jul 24, 2020
@aabadie
Copy link
Contributor

aabadie commented Jul 24, 2020

Staled, doesn't work anymore.

What is not working ?

@fjmolinas
Copy link
Contributor Author

Staled, doesn't work anymore.

What is not working ?

See #11808 (comment)

@aabadie
Copy link
Contributor

aabadie commented Jul 24, 2020

See #11808 (comment)

You mean "there are some issue with the script will address later." This is a bit vague ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: OTA Area: Over-the-air updates Area: tests Area: tests and testing framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants