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

travis.yml: upgrade to Ubuntu 20.04 and enable cli tests #256

Merged
merged 3 commits into from
Nov 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: go
sudo: false
dist: bionic
dist: focal
arch:
- amd64
- ppc64le
Expand Down Expand Up @@ -66,6 +66,14 @@ jobs:
- make coverage.out
- goveralls -coverprofile=coverage.out -service=travis-ci

- name: Command-line interface tests
sudo: required
before_install:
- sudo apt-get -y install e2fsprogs expect keyutils
script:
- GO111MODULE=on go get github.com/google/fscrypt/cmd/fscrypt
- make cli-test

- stage: deploy
name: Release Binaries
install: skip
Expand Down
2 changes: 1 addition & 1 deletion cli-tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ _user_do()
{
[ $# -ne 1 ] && _fail "wrong argument count to ${FUNCNAME[0]}"

su "$TEST_USER" --command="$1"
su "$TEST_USER" --shell=/bin/bash --command="export PATH='$PATH'; $1"
}

# Runs the given shell command as the test user and expects it to fail.
Expand Down
7 changes: 4 additions & 3 deletions cmd/fscrypt/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ func (p passphraseReader) Read(buf []byte) (int, error) {
// passphrase into a key. If we are not reading from a terminal, just read into
// the passphrase into the key normally.
func getPassphraseKey(prompt string) (*crypto.Key, error) {
if !quietFlag.Value {
fmt.Print(prompt)
}

// Only disable echo if stdin is actually a terminal.
if terminal.IsTerminal(stdinFd) {
Expand All @@ -102,6 +99,10 @@ func getPassphraseKey(prompt string) (*crypto.Key, error) {
}()
}

if !quietFlag.Value {
fmt.Print(prompt)
}

return crypto.NewKeyFromReader(passphraseReader{})
}

Expand Down