mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
c1197d7881
* Add static analysis for unsafe uint casting * Fix violations of uintcast * go mod tidy * Add exclusion to nogo for darwin build * Add test for math.Int * Move some things to const so they are assured not to exceed int64 * Self review * lint * fix tests * fix test * Add init check for non 64 bit OS * Move new deps from WORKSPACE to deps.bzl * fix bazel build for go analysis runs * Update BUILD.bazel Remove TODO * add math.AddInt method * Add new test casts * Add case where builtin functions and declared functions are covered * Fix new findings * cleanup Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Nishant Das <nishdas93@gmail.com>
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
// Copyright 2020 The Cockroach Authors.
|
|
//
|
|
// Use of this software is governed by the Business Source License
|
|
// included in the file licenses/BSL.txt.
|
|
//
|
|
// As of the Change Date specified in that file, in accordance with
|
|
// the Business Source License, use of this software will be governed
|
|
// by the Apache License, Version 2.0, included in the file
|
|
// licenses/APL.txt.
|
|
|
|
package bazel
|
|
|
|
import (
|
|
"path"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
)
|
|
|
|
// TestDataPath returns a path to an asset in the testdata directory. It knows
|
|
// to access accesses the right path when executing under bazel.
|
|
//
|
|
// For example, if there is a file testdata/a.txt, you can get a path to that
|
|
// file using TestDataPath(t, "a.txt").
|
|
func TestDataPath(t testing.TB, relative ...string) string {
|
|
relative = append([]string{"testdata"}, relative...)
|
|
// dev notifies the library that the test is running in a subdirectory of the
|
|
// workspace with the environment variable below.
|
|
if BuiltWithBazel() {
|
|
runfiles, err := RunfilesPath()
|
|
require.NoError(t, err)
|
|
return path.Join(runfiles, RelativeTestTargetPath(), path.Join(relative...))
|
|
}
|
|
|
|
// Otherwise we're in the package directory and can just return a relative path.
|
|
ret := path.Join(relative...)
|
|
ret, err := filepath.Abs(ret)
|
|
require.NoError(t, err)
|
|
return ret
|
|
}
|