blob: a62d609f367405785adc4b50282f2e828790e756 [file] [log] [blame]
package testutils
import (
"context"
"os"
"path"
"path/filepath"
"github.com/stretchr/testify/require"
"go.skia.org/infra/go/depot_tools"
"go.skia.org/infra/go/sktest"
"go.skia.org/infra/go/testutils"
)
// GetDepotTools returns the path to depot_tools, syncing it if necessary.
func GetDepotTools(t sktest.TestingT, ctx context.Context) string {
// Find the recipes cfg file, assuming we're in a checkout.
root := testutils.GetRepoRoot(t)
recipesCfgFile := filepath.Join(root, "infra/config/recipes.cfg")
// Use a special location, for local testing.
workdir := path.Join(os.TempDir(), "sktest_depot_tools")
rv, err := depot_tools.GetDepotTools(ctx, workdir, recipesCfgFile)
require.NoError(t, err)
return rv
}