mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
cmd/swarm, swarm/storage, swarm: fix mingw on windows test issues
This commit is contained in:
parent
cf286d6bc6
commit
c076cb78a3
3 changed files with 13 additions and 2 deletions
|
|
@ -14,6 +14,8 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// +build linux darwin freebsd
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,12 @@ func newTestDbStore(mock bool, trusted bool) (*testDbStore, func(), error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup := func() {
|
cleanup := func() {
|
||||||
if err != nil {
|
if db != nil {
|
||||||
db.Close()
|
db.Close()
|
||||||
}
|
}
|
||||||
err = os.RemoveAll(dir)
|
err = os.RemoveAll(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic("db cleanup failed")
|
panic(fmt.Sprintf("db cleanup failed: %v", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,12 @@
|
||||||
package swarm
|
package swarm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/hex"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -42,6 +44,13 @@ func TestNewSwarm(t *testing.T) {
|
||||||
// a simple rpc endpoint for testing dialing
|
// a simple rpc endpoint for testing dialing
|
||||||
ipcEndpoint := path.Join(dir, "TestSwarm.ipc")
|
ipcEndpoint := path.Join(dir, "TestSwarm.ipc")
|
||||||
|
|
||||||
|
// windows namedpipes are not on filesystem but on NPFS
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
b := make([]byte, 8)
|
||||||
|
rand.Read(b)
|
||||||
|
ipcEndpoint = `\\.\pipe\TestSwarm-` + hex.EncodeToString(b)
|
||||||
|
}
|
||||||
|
|
||||||
_, server, err := rpc.StartIPCEndpoint(ipcEndpoint, nil)
|
_, server, err := rpc.StartIPCEndpoint(ipcEndpoint, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue