Skip to content

Commit

Permalink
Remove flakey test optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
monopole committed May 22, 2020
1 parent 80dc476 commit 75d8492
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions api/internal/plugins/compiler/compiler.go
Expand Up @@ -11,7 +11,6 @@ import (
"os/exec"
"path/filepath"
"strings"
"time"

"github.com/pkg/errors"
)
Expand Down Expand Up @@ -65,16 +64,8 @@ func (b *Compiler) Cleanup() {
// ${pluginRoot}/${g}/${v}/$lower(${k} and places
// object code next to source code.
func (b *Compiler) Compile() error {
if FileYoungerThan(b.ObjPath(), 8*time.Second) {
// Skip rebuilding it, to save time in a plugin test file
// that has many distinct calls to make a harness and compile
// the plugin (only the first compile will happen).
// Make it a short time to avoid tricking someone who's actively
// developing a plugin.
return nil
}
if !FileExists(b.srcPath()) {
return fmt.Errorf("cannot find source at '%s'", b.srcPath())
return fmt.Errorf("cannot find source at '%s'", b.srcPath())
}
// If you use an IDE, make sure it's go build and test flags
// match those used below. Same goes for Makefile targets.
Expand Down Expand Up @@ -104,6 +95,9 @@ func (b *Compiler) Compile() error {
err, "cannot compile %s:\nSTDERR\n%s\n",
b.srcPath(), b.stderr.String())
}
if result := filepath.Join(b.workDir, b.objFile()); !FileExists(result) {
return fmt.Errorf("post compile, cannot find '%s'", result)
}
return nil
}

Expand Down

0 comments on commit 75d8492

Please sign in to comment.