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: modernize tests.session and port everything using it #8781

Merged
merged 9 commits into from Jun 2, 2020

Conversation

zyga
Copy link
Collaborator

@zyga zyga commented Jun 2, 2020

The main intent is to make tests.session match the specification in the tools
directory. Apart from the new name, "exec" is now required to run anything and
all actions are invoked as sub-commands, not as long options.

Bulk of the changes are entirely automatic and are documented in particular
commit messages. There's a handful of hand-edits and one test was ported by
hand entirely, after re-basing on top of new master.

zyga added 9 commits June 2, 2020 14:37
According to the tools agreement, the program is now called
tests.session.

The bulk of the rename was done with:

    find -type f -exec sed -i -e 's/session-tool/tests.session/g' {} \

In addition, the related tests were renamed to match. Note that this
change breaks compatibility and requires incoming patches to be
adjusted.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
According to the tools agreement, this is one of the commonly used
tools, that lives on PATH.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
According to the tools agreement, actions are proper sub-commands, not
options. This is a partial change, more is done in subsequent patches.

This is an entirely automatic change:

    find -type f -exec sed -i -e 's/tests.session -u test --prepare/tests.session -u test prepare/g' {} \;

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
According to the tools agreement, actions are proper sub-commands, not
options. This is a partial change, more is done in subsequent patches.

This is an entirely automatic change:

    find -type f -exec sed -i -e 's/tests.session -u test --restore/tests.session -u test restore/g' {} \;

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
According to the tools agreement, executing a command in a session needs
to be a proper sub-command.

This is an almost entirely automatic change. The result was hand-edited
to replace "tests.session ... exec -p ARG" with "tests.session ... -p
ARG exec":

    find -type f -exec perl -pi -e 's/tests.session -u (\S+) (?!prepare|restore|exec)/tests.session -u \1 exec \2/g' {} \;

The use of perl is to allow for negative lookahead, which sed does not
support.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
This completes the transition, capturing rarely used sub-commands like,
dump, kill-leaked and a few of the query-type commands.

This is an entirely automatic change:

    find -type f -exec perl -pi -e 's/tests.session --/tests.session /g' {} \;

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
All existing invocations of tests.session --foo were replaced with
tests.session foo, compatibility code can now be dropped.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
Use explicit "tests.session exec" instead.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
This test was merged after I completed the patches in this branch so I
just ported it manually for simplicity.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
@zyga zyga marked this pull request as ready for review June 2, 2020 15:05
Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

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

thank you

Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Thank you

@mvo5 mvo5 merged commit a85f54e into snapcore:master Jun 2, 2020
@zyga zyga deleted the tweak/tests.session branch June 2, 2020 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants