diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-08-11 14:39:23 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-08-12 15:11:32 +0300 |
commit | 50773386141d92bde81a43c6a807b1edeaba7e55 (patch) | |
tree | b879489004821462a052af194bd7c4670bfdce72 | |
parent | 64d4e377d6f0ae6381ef72af7c3c490f63641cc9 (diff) |
testhelper: Use CopyFile to copy binaries
We currently use cp(1) to copy built binaries into their target
location. Using external commands to implement such simple functionality
always feels like a code smell, so let's refactor this to use our
`CopyFile()` helper followed by making it executable.
-rw-r--r-- | internal/testhelper/build.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/testhelper/build.go b/internal/testhelper/build.go index 43004eff6..56b1df8f4 100644 --- a/internal/testhelper/build.go +++ b/internal/testhelper/build.go @@ -55,7 +55,9 @@ func buildBinary(t testing.TB, dstDir, name string) { if !t.Failed() { // copy compiled binary to the destination folder require.NoError(t, os.MkdirAll(dstDir, os.ModePerm)) - MustRunCommand(t, nil, "cp", binPath, dstDir) + targetPath := filepath.Join(dstDir, name) + CopyFile(t, binPath, targetPath) + require.NoError(t, os.Chmod(targetPath, 0777)) } }() |