helper: move test sample data out of direct
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
parent
55a5b6f242
commit
3c5185d770
|
@ -62,11 +62,11 @@ func (h *direct) Wait() error {
|
||||||
if h.Cmd.Process == nil {
|
if h.Cmd.Process == nil {
|
||||||
return errors.New("exec: not started")
|
return errors.New("exec: not started")
|
||||||
}
|
}
|
||||||
|
defer h.p.mustClosePipes()
|
||||||
if h.Cmd.ProcessState != nil {
|
if h.Cmd.ProcessState != nil {
|
||||||
return errors.New("exec: Wait was already called")
|
return errors.New("exec: Wait was already called")
|
||||||
}
|
}
|
||||||
|
|
||||||
defer h.p.mustClosePipes()
|
|
||||||
return h.Cmd.Wait()
|
return h.Cmd.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -12,28 +11,6 @@ import (
|
||||||
"git.ophivana.moe/cat/fortify/helper"
|
"git.ophivana.moe/cat/fortify/helper"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
want = []string{
|
|
||||||
"unix:path=/run/dbus/system_bus_socket",
|
|
||||||
"/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47/system_bus_socket",
|
|
||||||
"--filter",
|
|
||||||
"--talk=org.bluez",
|
|
||||||
"--talk=org.freedesktop.Avahi",
|
|
||||||
"--talk=org.freedesktop.UPower",
|
|
||||||
}
|
|
||||||
|
|
||||||
wantPayload = strings.Join(want, "\x00") + "\x00"
|
|
||||||
argsWt = helper.MustNewCheckedArgs(want)
|
|
||||||
)
|
|
||||||
|
|
||||||
func argF(argsFD int, _ int) []string {
|
|
||||||
return []string{"--args", strconv.Itoa(argsFD)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func argFStatus(argsFD int, statFD int) []string {
|
|
||||||
return []string{"--args", strconv.Itoa(argsFD), "--fd", strconv.Itoa(statFD)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestHelper_StartNotify_Close_Wait(t *testing.T) {
|
func TestHelper_StartNotify_Close_Wait(t *testing.T) {
|
||||||
helper.InternalReplaceExecCommand(t)
|
helper.InternalReplaceExecCommand(t)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package helper_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"git.ophivana.moe/cat/fortify/helper"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
want = []string{
|
||||||
|
"unix:path=/run/dbus/system_bus_socket",
|
||||||
|
"/tmp/fortify.1971/12622d846cc3fe7b4c10359d01f0eb47/system_bus_socket",
|
||||||
|
"--filter",
|
||||||
|
"--talk=org.bluez",
|
||||||
|
"--talk=org.freedesktop.Avahi",
|
||||||
|
"--talk=org.freedesktop.UPower",
|
||||||
|
}
|
||||||
|
|
||||||
|
wantPayload = strings.Join(want, "\x00") + "\x00"
|
||||||
|
argsWt = helper.MustNewCheckedArgs(want)
|
||||||
|
)
|
||||||
|
|
||||||
|
func argF(argsFD int, _ int) []string {
|
||||||
|
return []string{"--args", strconv.Itoa(argsFD)}
|
||||||
|
}
|
||||||
|
|
||||||
|
func argFStatus(argsFD int, statFD int) []string {
|
||||||
|
return []string{"--args", strconv.Itoa(argsFD), "--fd", strconv.Itoa(statFD)}
|
||||||
|
}
|
Loading…
Reference in New Issue