sourcegraph/internal/sanitycheck
Jean-Hadrien Chabran ee4b4007aa
Running binaries with SANITY_CHECK=true immediately exits with a code zero (#52186)
As we're using
https://github.com/GoogleContainerTools/container-structure-test when
building images with Bazel, we can write tests that ensures that the
binaries we produced are executable on the current platform.

The code using this feature is not present in this PR, as it makes it
much more readable for everyone to ship this independently.

We may still be bitten by `init()` functions, but we'll set low timeouts
on those container structure tests to ensure it stays quick.

## Test plan

<!-- All pull requests REQUIRE a test plan:
https://docs.sourcegraph.com/dev/background-information/testing_principles
-->



```
~/work/other  jh/sanity_check $ SANITY_CHECK=true ./bazel-bin/docker-images/syntax-highlighter/syntect_server
Sanity check passed, exiting without error

~/work/other U jh/sanity_check $ ./bazel-bin/docker-images/syntax-highlighter/syntect_server  
## Embedded themes:

- `InspiredGitHub`
- `Monokai`
- `Solarized (dark)`
# ... 
```

```
~/work/other  jh/sanity_check $ SANITY_CHECK=true bazel-bin/cmd/worker/worker_/worker
Sanity check passed, exiting without error

```
2023-05-19 12:30:11 +00:00
..
BUILD.bazel Running binaries with SANITY_CHECK=true immediately exits with a code zero (#52186) 2023-05-19 12:30:11 +00:00
sanitycheck.go Running binaries with SANITY_CHECK=true immediately exits with a code zero (#52186) 2023-05-19 12:30:11 +00:00