make+itest: make itest Windows compatible
This commit is contained in:
parent
2f1f8561ae
commit
6115a7b12b
7
Makefile
7
Makefile
@ -132,6 +132,11 @@ build-itest:
|
|||||||
$(GOBUILD) -tags="$(ITEST_TAGS)" -o lnd-itest $(ITEST_LDFLAGS) $(PKG)/cmd/lnd
|
$(GOBUILD) -tags="$(ITEST_TAGS)" -o lnd-itest $(ITEST_LDFLAGS) $(PKG)/cmd/lnd
|
||||||
$(GOBUILD) -tags="$(ITEST_TAGS)" -o lncli-itest $(ITEST_LDFLAGS) $(PKG)/cmd/lncli
|
$(GOBUILD) -tags="$(ITEST_TAGS)" -o lncli-itest $(ITEST_LDFLAGS) $(PKG)/cmd/lncli
|
||||||
|
|
||||||
|
build-itest-windows:
|
||||||
|
@$(call print, "Building itest lnd and lncli.")
|
||||||
|
$(GOBUILD) -tags="$(ITEST_TAGS)" -o lnd-itest.exe $(ITEST_LDFLAGS) $(PKG)/cmd/lnd
|
||||||
|
$(GOBUILD) -tags="$(ITEST_TAGS)" -o lncli-itest.exe $(ITEST_LDFLAGS) $(PKG)/cmd/lncli
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@$(call print, "Installing lnd and lncli.")
|
@$(call print, "Installing lnd and lncli.")
|
||||||
$(GOINSTALL) -tags="${tags}" $(LDFLAGS) $(PKG)/cmd/lnd
|
$(GOINSTALL) -tags="${tags}" $(LDFLAGS) $(PKG)/cmd/lnd
|
||||||
@ -158,6 +163,8 @@ itest-only:
|
|||||||
|
|
||||||
itest: btcd build-itest itest-only
|
itest: btcd build-itest itest-only
|
||||||
|
|
||||||
|
itest-windows: btcd build-itest-windows itest-only
|
||||||
|
|
||||||
unit: btcd
|
unit: btcd
|
||||||
@$(call print, "Running unit tests.")
|
@$(call print, "Running unit tests.")
|
||||||
$(UNIT)
|
$(UNIT)
|
||||||
|
@ -81,6 +81,7 @@ func NewBackend(miner string, netParams *chaincfg.Params) (
|
|||||||
"--debuglevel=debug",
|
"--debuglevel=debug",
|
||||||
"--logdir=" + logDir,
|
"--logdir=" + logDir,
|
||||||
"--connect=" + miner,
|
"--connect=" + miner,
|
||||||
|
"--nowinservice",
|
||||||
}
|
}
|
||||||
chainBackend, err := rpctest.New(netParams, nil, args)
|
chainBackend, err := rpctest.New(netParams, nil, args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
@ -2462,9 +2463,14 @@ func testOpenChannelAfterReorg(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Set up a new miner that we can use to cause a reorg.
|
// Set up a new miner that we can use to cause a reorg.
|
||||||
args := []string{"--rejectnonstd", "--txindex"}
|
args := []string{
|
||||||
tempMiner, err := rpctest.New(harnessNetParams,
|
"--rejectnonstd",
|
||||||
&rpcclient.NotificationHandlers{}, args)
|
"--txindex",
|
||||||
|
"--nowinservice",
|
||||||
|
}
|
||||||
|
tempMiner, err := rpctest.New(
|
||||||
|
harnessNetParams, &rpcclient.NotificationHandlers{}, args,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to create mining node: %v", err)
|
t.Fatalf("unable to create mining node: %v", err)
|
||||||
}
|
}
|
||||||
@ -15284,6 +15290,7 @@ func TestLightningNetworkDaemon(t *testing.T) {
|
|||||||
"--debuglevel=debug",
|
"--debuglevel=debug",
|
||||||
"--logdir=" + minerLogDir,
|
"--logdir=" + minerLogDir,
|
||||||
"--trickleinterval=100ms",
|
"--trickleinterval=100ms",
|
||||||
|
"--nowinservice",
|
||||||
}
|
}
|
||||||
handlers := &rpcclient.NotificationHandlers{
|
handlers := &rpcclient.NotificationHandlers{
|
||||||
OnTxAccepted: func(hash *chainhash.Hash, amt btcutil.Amount) {
|
OnTxAccepted: func(hash *chainhash.Hash, amt btcutil.Amount) {
|
||||||
@ -15329,11 +15336,24 @@ func TestLightningNetworkDaemon(t *testing.T) {
|
|||||||
ht.Fatalf("unable to request transaction notifications: %v", err)
|
ht.Fatalf("unable to request transaction notifications: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binary := itestLndBinary
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
// Windows (even in a bash like environment like git bash as on
|
||||||
|
// Travis) doesn't seem to like relative paths to exe files...
|
||||||
|
currentDir, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
ht.Fatalf("unable to get working directory: %v", err)
|
||||||
|
}
|
||||||
|
targetPath := filepath.Join(currentDir, "../../lnd-itest.exe")
|
||||||
|
binary, err = filepath.Abs(targetPath)
|
||||||
|
if err != nil {
|
||||||
|
ht.Fatalf("unable to get absolute path: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now we can set up our test harness (LND instance), with the chain
|
// Now we can set up our test harness (LND instance), with the chain
|
||||||
// backend we just created.
|
// backend we just created.
|
||||||
lndHarness, err = lntest.NewNetworkHarness(
|
lndHarness, err = lntest.NewNetworkHarness(miner, chainBackend, binary)
|
||||||
miner, chainBackend, itestLndBinary,
|
|
||||||
)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ht.Fatalf("unable to create lightning network harness: %v", err)
|
ht.Fatalf("unable to create lightning network harness: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user