Page MenuHomeFreeBSD

Fix geom tests after argument changes
ClosedPublic

Authored by brd on Oct 29 2021, 5:18 PM.

Details

Summary

After the changes in 68bff4a07e3fa6c30a0c0ff6cf5f0bef95dcbd72, the tests need to be updated to account for the change in output.

Test Plan

kyua test

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

brd requested review of this revision.Oct 29 2021, 5:18 PM

Do these utilities always run in verbose mode now?

I am also checking this, but what I haven't figured out is that it seems these test cases don't execute geom utility commands with -v so it should not expect the output from verbose mode. Is there anything I missed that those test cases do enable the verbose flag?

Shouldn't the root cause be fixed (geom be revert back to non-verbose mode by default) in place of fixing the regression test ?

Shouldn't the root cause be fixed (geom be revert back to non-verbose mode by default) in place of fixing the regression test ?

Yes. I've sent e-mail to Kirk about it, but I've not heard back yet. I've looked enough at his patch to convince myself that the new output is a bug, but I've not managed to figure out how to fix it.

Sorry for my long delay.

I concur that it is my change that should be fixed, not these tests.

I believe that the correct fix is this:

diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c
index 2e0d8683df49..0202be9a063e 100644
--- a/sbin/geom/core/geom.c
+++ b/sbin/geom/core/geom.c
@@ -445,7 +445,7 @@ set_flags(struct g_command *cmd)
 {
        unsigned flags = 0;

-       if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0)
+       if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0 && verbose)
                flags |= G_FLAG_VERBOSE;

        return (flags);

Sorry for my long delay.

I concur that it is my change that should be fixed, not these tests.

I believe that the correct fix is this:

diff --git a/sbin/geom/core/geom.c b/sbin/geom/core/geom.c
index 2e0d8683df49..0202be9a063e 100644
--- a/sbin/geom/core/geom.c
+++ b/sbin/geom/core/geom.c
@@ -445,7 +445,7 @@ set_flags(struct g_command *cmd)
 {
        unsigned flags = 0;

-       if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0)
+       if ((cmd->gc_flags & G_FLAG_VERBOSE) != 0 && verbose)
                flags |= G_FLAG_VERBOSE;

        return (flags);

Thanks. That seems to fix it all.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 11 2021, 8:12 PM
This revision was automatically updated to reflect the committed changes.