From f28d85fad599ffaef9a8e1f353911c81a6605d2f Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 1 Apr 2018 21:23:32 +0200 Subject: fsck: add initial implementation Most corruption cases except xattr should be covered. With test filesystem. The output is still pretty ugly. xattr support will be added in the next commits. --- tests/test_helpers/helpers.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/test_helpers') diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go index 5c0319e..f92fb79 100644 --- a/tests/test_helpers/helpers.go +++ b/tests/test_helpers/helpers.go @@ -400,3 +400,15 @@ func QueryCtlSock(t *testing.T, socketPath string, req ctlsock.RequestStruct) (r json.Unmarshal(buf, &response) return response } + +// Extract the exit code from an error value that was returned from +// exec / cmd.Run() +func ExtractCmdExitCode(err error) int { + if err == nil { + return 0 + } + // OMG this is convoluted + err2 := err.(*exec.ExitError) + code := err2.Sys().(syscall.WaitStatus).ExitStatus() + return code +} -- cgit v1.2.3