Add better error message to ValidateInstructions (#2365)
Fixes #2364
diff --git a/test/val/val_fixtures.h b/test/val/val_fixtures.h
index 69bc9d8..fd5368b 100644
--- a/test/val/val_fixtures.h
+++ b/test/val/val_fixtures.h
@@ -125,6 +125,13 @@
template <typename T>
spv_result_t ValidateBase<T>::ValidateInstructions(spv_target_env env) {
DestroyDiagnostic();
+ if (binary_ == nullptr) {
+ fprintf(stderr,
+ "ERROR: Attempting to validate a null binary, did you forget to "
+ "call CompileSuccessfully?");
+ fflush(stderr);
+ }
+ assert(binary_ != nullptr);
return spvValidateWithOptions(ScopedContext(env).context, options_,
get_const_binary(), &diagnostic_);
}