Skip to content

Commit

Permalink
tests/thirdparty: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcloughlin committed Apr 8, 2021
1 parent 899a3ca commit 22d6ec5
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 188 deletions.
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
github.com/yuin/goldmark v1.2.1 h1:ruQGxdhGHe7FWOJPT0mKs5+pD2Xs1Bm/kdGlHO04FmM=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff h1:XmKBi9R6duxOB3lfc72wyrwiOY7X2Jl1wuI+RFOyMDE=
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
Expand Down
278 changes: 93 additions & 185 deletions tests/thirdparty/packages.json
Original file line number Diff line number Diff line change
@@ -1,187 +1,95 @@
[
{
"import_path": "github.com/zeebo/xxh3",
"version": "65f423c10688c362d2a2ce6987b665c72ee7bddd",
"dir": "avo",
"generate": [
[
"go",
"run",
".",
"-avx",
"-out",
"../vector_avx_amd64.s"
],
[
"go",
"run",
".",
"-sse",
"-out",
"../vector_sse_amd64.s"
]
]
},
{
"import_path": "github.com/dgryski/go-sip13",
"version": "25c5027a8c7bfa6dab4b577e53e5c9068f6e2152",
"generate": [
[
"go",
"run",
"_avo/asm.go",
"-out",
"sip13_amd64.s"
]
]
},
{
"import_path": "github.com/orisano/wyhash",
"version": "32a3f7f6ba4797e2d87dab2969cc9dd63d39cce9",
"generate": [
[
"go",
"run",
"avo/gen.go",
"-out",
"blocks_amd64.s",
"-stubs",
"blocks_amd64.go"
]
]
},
{
"import_path": "github.com/dgryski/go-bloomindex",
"version": "0902316dce158c154b958ee5cfc706c62af29a42",
"generate": [
[
"go",
"run",
"asm.go",
"-out",
"query_amd64.s"
]
]
},
{
"import_path": "github.com/dgryski/go-marvin32",
"version": "7d18f4c6ea7c24b29d1c7a670f8ae40b0812f2e3",
"generate": [
[
"go",
"run",
"asm.go",
"-out",
"marvin_amd64.s"
]
]
},
{
"import_path": "github.com/dgryski/go-speck",
"version": "5b36d4c08d8840c352a153bf37281434ad550ec0",
"generate": [
[
"go",
"run",
"asm.go",
"-out",
"speck_amd64.s"
]
]
},
{
"import_path": "github.com/dgryski/go-chaskey",
"version": "ba454392bc5ab6daae103e15147185f8f4a27dcc",
"generate": [
[
"go",
"run",
"asm.go",
"-out",
"core_amd64.s"
]
]
},
{
"import_path": "github.com/mkevac/gopherconrussia2019",
"version": "235b8b0156a20b4e078b88462e669730f99caeb1",
"dir": "simplesimd",
"generate": [
[
"go",
"run",
"asm.go",
"-out",
"simd.s",
"-stubs",
"stub.go"
]
]
},
{
"import_path": "github.com/phoreproject/bls",
"version": "9d5f85bf4a9badf491a1b9b27fb3344b489bd2c4",
"generate": [
[
"go",
"run",
"asm/asm.go",
"-out",
"primitivefuncs_amd64.s"
]
]
},
{
"import_path": "github.com/klauspost/compress",
"version": "23a5980ed240fd76b89481403c834f48943b3788",
"dir": "s2",
"generate": [
[
"go",
"run",
"gen.go",
"-out",
"encodeblock_amd64.s",
"-stubs",
"encodeblock_amd64.go"
]
],
"test": "./s2"
},
{
"import_path": "github.com/zeebo/blake3",
"version": "25dba572f0e78ec108f0dd79c9c15288f542d7d9",
"dir": "avo",
"generate": [
[
"go",
"run",
"./avx2",
"-out",
"../avx2/impl.s"
],
[
"go",
"run",
"./sse41",
"-out",
"../sse41/impl.s"
]
]
},
{
"import_path": "github.com/lukechampine/us",
"version": "dff56a80f83653cb14eeeb57ba6ba3c3e942c412",
"dir": "merkle/blake2b",
"generate": [
[
"go",
"run",
"gen.go",
"-out",
"blake2b_amd64.s"
]
],
"test": "./merkle/..."
}
{
"import_path": "github.com/zeebo/xxh3",
"version": "65f423c10688c362d2a2ce6987b665c72ee7bddd",
"dir": "avo",
"generate": [
["go", "run", ".", "-avx", "-out", "../vector_avx_amd64.s"],
["go", "run", ".", "-sse", "-out", "../vector_sse_amd64.s"]
]
},
{
"import_path": "github.com/dgryski/go-sip13",
"version": "25c5027a8c7bfa6dab4b577e53e5c9068f6e2152",
"generate": [["go", "run", "_avo/asm.go", "-out", "sip13_amd64.s"]]
},
{
"import_path": "github.com/orisano/wyhash",
"version": "32a3f7f6ba4797e2d87dab2969cc9dd63d39cce9",
"generate": [
[
"go",
"run",
"avo/gen.go",
"-out",
"blocks_amd64.s",
"-stubs",
"blocks_amd64.go"
]
]
},
{
"import_path": "github.com/dgryski/go-bloomindex",
"version": "0902316dce158c154b958ee5cfc706c62af29a42",
"generate": [["go", "run", "asm.go", "-out", "query_amd64.s"]]
},
{
"import_path": "github.com/dgryski/go-marvin32",
"version": "7d18f4c6ea7c24b29d1c7a670f8ae40b0812f2e3",
"generate": [["go", "run", "asm.go", "-out", "marvin_amd64.s"]]
},
{
"import_path": "github.com/dgryski/go-speck",
"version": "5b36d4c08d8840c352a153bf37281434ad550ec0",
"generate": [["go", "run", "asm.go", "-out", "speck_amd64.s"]]
},
{
"import_path": "github.com/dgryski/go-chaskey",
"version": "ba454392bc5ab6daae103e15147185f8f4a27dcc",
"generate": [["go", "run", "asm.go", "-out", "core_amd64.s"]]
},
{
"import_path": "github.com/mkevac/gopherconrussia2019",
"version": "235b8b0156a20b4e078b88462e669730f99caeb1",
"dir": "simplesimd",
"generate": [["go", "run", "asm.go", "-out", "simd.s", "-stubs", "stub.go"]]
},
{
"import_path": "github.com/phoreproject/bls",
"version": "9d5f85bf4a9badf491a1b9b27fb3344b489bd2c4",
"generate": [["go", "run", "asm/asm.go", "-out", "primitivefuncs_amd64.s"]]
},
{
"import_path": "github.com/klauspost/compress",
"version": "23a5980ed240fd76b89481403c834f48943b3788",
"dir": "s2",
"generate": [
[
"go",
"run",
"gen.go",
"-out",
"encodeblock_amd64.s",
"-stubs",
"encodeblock_amd64.go"
]
],
"test": "./s2"
},
{
"import_path": "github.com/zeebo/blake3",
"version": "25dba572f0e78ec108f0dd79c9c15288f542d7d9",
"dir": "avo",
"generate": [
["go", "run", "./avx2", "-out", "../avx2/impl.s"],
["go", "run", "./sse41", "-out", "../sse41/impl.s"]
]
},
{
"import_path": "github.com/lukechampine/us",
"version": "dff56a80f83653cb14eeeb57ba6ba3c3e942c412",
"dir": "merkle/blake2b",
"generate": [["go", "run", "gen.go", "-out", "blake2b_amd64.s"]],
"test": "./merkle/..."
}
]
21 changes: 18 additions & 3 deletions tests/thirdparty/packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type PackageTest struct {
Latest bool // use latest version of the package

repopath string // path the repo is cloned to
cwd string // working directory to execute commands in
}

// Run the test.
Expand All @@ -79,6 +80,7 @@ func (t *PackageTest) checkout() {
dst := filepath.Join(t.WorkDir, t.Name())
t.git("clone", "--quiet", t.CloneURL(), dst)
t.repopath = dst
t.cd(t.repopath)

// Checkout specific version.
if t.Latest {
Expand All @@ -103,6 +105,7 @@ func (t *PackageTest) modinit() {

// replaceavo points all avo dependencies to the local version.
func (t *PackageTest) replaceavo() {

// Determine the path to avo.
_, self, _, ok := runtime.Caller(1)
if !ok {
Expand All @@ -115,15 +118,22 @@ func (t *PackageTest) replaceavo() {
if err != nil {
return err
}
if filepath.Base(path) != "go.mod" {
dir, base := filepath.Split(path)
if base != "go.mod" {
return nil
}
t.gotool("mod", "edit", "-replace=github.com/mmcloughlin/avo="+avodir, path)
t.cd(dir)
t.gotool("mod", "tidy")
t.gotool("get", "github.com/mmcloughlin/avo")
t.gotool("mod", "edit", "-replace=github.com/mmcloughlin/avo="+avodir)
t.gotool("mod", "download")
return nil
})
if err != nil {
t.Fatal(err)
}

t.cd(t.repopath)
}

// generate runs generate commands.
Expand Down Expand Up @@ -156,6 +166,11 @@ func (t *PackageTest) git(arg ...string) {
// gotool runs a go command.
func (t *PackageTest) gotool(arg ...string) {
cmd := exec.Command(test.GoTool(), arg...)
cmd.Dir = t.repopath
cmd.Dir = t.cwd
test.ExecCommand(t.T, cmd)
}

// cd sets the working directory.
func (t *PackageTest) cd(dir string) {
t.cwd = dir
}

0 comments on commit 22d6ec5

Please sign in to comment.