--- run_build.pl~	2025-03-04 16:34:04.082252563 -0500
+++ run_build.pl	2025-03-04 16:35:25.967357487 -0500
@@ -2483,6 +2483,11 @@ sub run_misc_tests
 		my $testname = basename($testdir);
 		next if $testname =~ /ssl/ && !$using_ssl;
 		next unless -d "$testdir/t";
+
+		# can't test it if we haven't built it
+		next unless grep -e, glob("$testdir/*.o $testdir/*.obj")
+			or not grep -e, glob("$testdir/*.c");
+
 		next if $using_msvc && $testname eq 'pg_bsd_indent';
 		next unless step_wanted("module-$testname");
 		print time_str(), "running misc test module-$testname ...\n"
@@ -2496,7 +2501,7 @@ sub run_misc_tests
 		my $testname = basename($testdir);
 
 		# can't test it if we haven't built it
-		next unless scalar glob("$testdir/*.o $testdir/*.obj");
+		next unless grep -e, glob("$testdir/*.o $testdir/*.obj");
 
 		# skip sepgsql unless it's marked for testing
 		next if $testname eq 'sepgsql' && $ENV{PG_TEST_EXTRA} !~ /\bsepgsql\b/;
