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

Fix EchoQuotedArgsUnix/AssertEchoArgs #122

Merged
merged 1 commit into from
Apr 26, 2017
Merged

Conversation

axw
Copy link
Contributor

@axw axw commented Apr 24, 2017

The EchoQuotedArgsUnix script writes
a file to record the command line arguments
of the process. The script was using
the basename, which only works as
expected if the command is run in the
CWD set at the time of the AssertEchoArgs
call.

Instead of this, write to the location
of the script + ".out", and then read
from the same location in AssertEchoArgs
using os/exec.LookPath. We also introduce
ReadEchoArgs to fetch the value without
checking its contents.

The EchoQuotedArgsUnix script writes
a file to record the command line arguments
of the process. The script was using
the basename, which only works as
expected if the command is run in the
CWD set at the time of the AssertEchoArgs
call.

Instead of this, write to the location
of the script + ".out", and then read
from the same location in AssertEchoArgs
using os/exec.LookPath. We also introduce
ReadEchoArgs to fetch the value without
checking its contents.
Copy link
Member

@jameinel jameinel left a comment

Choose a reason for hiding this comment

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

why is ReadEchoArgs also an exposed function? It seems very tied to having the content put into a '.out' file which is only really assured by AssertEchoArgs, isn't it?

@axw
Copy link
Contributor Author

axw commented Apr 26, 2017

why is ReadEchoArgs also an exposed function?

Because the arg values may be partially non-deterministic. e.g. in my case, one of the args is a temporary directory.

It seems very tied to having the content put into a '.out' file which is only really assured by AssertEchoArgs, isn't it?

They provide the same assurances. AssertEchoArgs defers most of the work to ReadEchoArgs.

@axw
Copy link
Contributor Author

axw commented Apr 26, 2017

$$merge$$

@jujubot
Copy link
Contributor

jujubot commented Apr 26, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-testing

@jujubot jujubot merged commit 643808b into juju:master Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants