tests/thirdparty: add crypto/internal/bigmod (#355)

Add test case for avo generator in standard library crypto/internal/bigmod.

https://github.com/golang/go/tree/go1.20rc2/src/crypto/internal/bigmod
https://golang.org/cl/452095
https://words.filippo.io/dispatches/go-1-20-cryptography/

Closes #354
This commit is contained in:
Michael McLoughlin
2023-01-07 13:17:16 -08:00
committed by GitHub
parent 67039b7ed9
commit 12b5abca55
5 changed files with 133 additions and 18 deletions

View File

@@ -2,6 +2,7 @@ package thirdparty
import (
"flag"
"os"
"os/exec"
"path/filepath"
"runtime"
@@ -69,6 +70,7 @@ type PackageTest struct {
// Run the test.
func (t *PackageTest) Run() {
t.checkout()
t.validate()
t.steps()
}
@@ -88,6 +90,24 @@ func (t *PackageTest) checkout() {
test.Exec(t.T, "git", "-C", t.repopath, "checkout", "FETCH_HEAD")
}
// validate the test configuration relative to the checked out project.
func (t *PackageTest) validate() {
// Confirm expected directories exist.
expect := map[string]string{
"package": t.Package.SubPackage,
"root": t.Package.WorkingDirectory(),
}
for name, subdir := range expect {
if subdir == "" {
continue
}
path := filepath.Join(t.repopath, subdir)
if _, err := os.Stat(path); err != nil {
t.Fatalf("expected %s directory: %s", name, err)
}
}
}
func (t *PackageTest) steps() {
// Determine the path to avo.
_, self, _, ok := runtime.Caller(1)