Skip to content

Commit

Permalink
Permit individual suites (#181)
Browse files Browse the repository at this point in the history
* Permit running individual test suites

* Logging which suites are running
  • Loading branch information
blast-hardcheese authored Dec 18, 2023
1 parent a27af47 commit 5a84a0c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ test-suite:
else
test-suite:
nix develop -c nix shell -c go test -run $(GO_TEST_RUN_OPTS) ./test-suite

test-%:
nix develop -c nix shell -c make wrapped-$@

wrapped-test-%:
suite_prefix="$$(echo "$@" | cut -d- -f 3-)"; \
echo "Running $$suite_prefix"; \
cd test-suite; \
UPM_SUITE_PREFIX="$$suite_prefix" go test
endif

fmt:
Expand Down
10 changes: 10 additions & 0 deletions test-suite/Main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package testSuite

import (
"context"
"fmt"
"os"
"strings"

"github.com/replit/upm/internal/backends"
"github.com/replit/upm/test-suite/templates"
Expand All @@ -19,8 +22,15 @@ var standardTemplates = []string{
func init() {
backends.SetupAll()

fmt.Println("Preparing test suites:")
for _, bn := range backends.GetBackendNames() {
prefix := os.Getenv("UPM_SUITE_PREFIX")
if !strings.HasPrefix(bn, prefix) {
continue
}
fmt.Println("- " + bn)
bt := testUtils.InitBackendT(backends.GetBackend(context.Background(), bn), &templates.FS)
languageBackends = append(languageBackends, bt)
}
fmt.Println()
}

0 comments on commit 5a84a0c

Please sign in to comment.