Remove amd64 darwin from onnxruntime_test.go

- Even though the amd64 darwin .dylib file was removed from test_data,
   onnxruntime_test.go still would attempt to set a path for it. This
   change cleans up the code to clarify the three libraries that are
   included in test_data, and fails if no library is loaded.
This commit is contained in:
yalue
2026-02-17 09:32:16 -05:00
parent e25f45b51c
commit 45eb52b8ed
3 changed files with 14 additions and 14 deletions
+3 -4
View File
@@ -49,8 +49,7 @@ Tests
- No tests should panic. Always check errors and fail rather than allowing
tests to panic.
- Every change must ensure that `go test -v -bench=.` passes on every
supported platform.
- Every change must ensure that `go test -v -bench=.` passes.
- Every test failure should be accompanied by a message containing the reason,
either using `t.Logf()`, `t.Errorf()`, or `t.Fatalf()`.
@@ -74,8 +73,8 @@ Adding New Files
these files are updated. The libraries that are included were only intended
to allow a majority of users to run `go test -v -bench=.` without further
setup or modification. Currently: amd64 Windows, arm64 Linux (I wish I
hadn't included this!), arm64 osx, and amd64 osx. All other users must set
the `ONNXRUNTIME_SHARED_LIBRARY_PATH` environment variable to a valid path
hadn't included this!), and arm64 osx. All other users must set the
`ONNXRUNTIME_SHARED_LIBRARY_PATH` environment variable to a valid path
to the correct `onnxruntime` shared library file prior to running tests.
- If you need to add a .onnx file for a test, place both the .onnx file
+1 -1
View File
@@ -59,7 +59,7 @@ download from the releases page in the
for the release you want to use, and extract it. The header files are located
in the "include" subdirectory, and the shared library will be located in the
"lib" subdirectory. (On Linux systems, you'll need the version of the .so with
the appended version numbers, e.g., `libonnxruntime.so.1.23.2`, and _not_ the
the appended version numbers, e.g., `libonnxruntime.so.1.24.1`, and _not_ the
`libonnxruntime.so`, which is just a symbolic link.) The archive will contain
several other files containing C++ headers, debug symbols, and so on, but you
shouldn't need anything other than the single onnxruntime shared library and
+10 -9
View File
@@ -24,19 +24,20 @@ func getTestSharedLibraryPath(t testing.TB) string {
if toReturn != "" {
return toReturn
}
if runtime.GOOS == "windows" {
if (runtime.GOOS == "windows") && (runtime.GOARCH == "amd64") {
return "test_data/onnxruntime.dll"
}
if runtime.GOARCH == "arm64" {
if runtime.GOOS == "darwin" {
return "test_data/onnxruntime_arm64.dylib"
}
if (runtime.GOOS == "darwin") && (runtime.GOARCH == "arm64") {
return "test_data/onnxruntime_arm64.dylib"
}
if (runtime.GOOS == "linux") && (runtime.GOARCH == "arm64") {
return "test_data/onnxruntime_arm64.so"
}
if runtime.GOARCH == "amd64" && runtime.GOOS == "darwin" {
return "test_data/onnxruntime_amd64.dylib"
}
return "test_data/onnxruntime.so"
t.Fatalf("Unable to find an onnxruntime shared library for GOOS %s and "+
"GOARCH %s. Set the ONNXRUNTIME_SHARED_LIBRARY_PATH environment "+
"variable to run tests on your system.\n", runtime.GOOS,
runtime.GOARCH)
return fmt.Sprintf("onnxruntime_%s_%s.so", runtime.GOOS, runtime.GOARCH)
}
// This must be called prior to running each test.