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
|
||||
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// +build linux darwin freebsd
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
|
|
|||
|
|
@ -59,12 +59,12 @@ func newTestDbStore(mock bool, trusted bool) (*testDbStore, func(), error) {
|
|||
}
|
||||
|
||||
cleanup := func() {
|
||||
if err != nil {
|
||||
if db != nil {
|
||||
db.Close()
|
||||
}
|
||||
err = os.RemoveAll(dir)
|
||||
if err != nil {
|
||||
panic("db cleanup failed")
|
||||
panic(fmt.Sprintf("db cleanup failed: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@
|
|||
package swarm
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -42,6 +44,13 @@ func TestNewSwarm(t *testing.T) {
|
|||
// a simple rpc endpoint for testing dialing
|
||||
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)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue