-
Notifications
You must be signed in to change notification settings - Fork 1
[codex] Add failsafe-driven compatibility harness #451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bertysentry
merged 15 commits into
main
from
450-gawk-compatibility-it-harness-for-jawk
Apr 23, 2026
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8dc67d9
Add failsafe-driven compatibility harness
bertysentry 7a469cd
Address review feedback on compatibility harness
bertysentry 096e542
Preserve raw stdin bytes in gawk ITs
bertysentry 15f080c
Tighten compatibility harness review fixes
bertysentry 7726afb
Add curated manual gawk compatibility cases
bertysentry f2f5955
Replace manual gawk manifest with direct IT
bertysentry ab780ed
Address remaining PR review feedback
bertysentry 1581b35
Simplify gawk compatibility test support
bertysentry 37935ae
Delegate compatibility diffs to JUnit
bertysentry d6d7d4a
Use AwkTestSupport expectations for gawk suites
bertysentry 90680c0
Align compatibility suites on filesystem resources
bertysentry ab6ea81
Handle zero-length regex record separators
bertysentry 0881693
Split gawk compatibility suites by test family
bertysentry 2a54918
Clarify formatter sequencing in agent guide
bertysentry 80b4709
Update AGENTS.md
bertysentry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| package io.jawk; | ||
|
|
||
| /*- | ||
| * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ | ||
| * Jawk | ||
| * ჻჻჻჻჻჻ | ||
| * Copyright 2006 - 2026 MetricsHub | ||
| * ჻჻჻჻჻჻ | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Lesser Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Lesser Public | ||
| * License along with this program. If not, see | ||
| * <http://www.gnu.org/licenses/lgpl-3.0.html>. | ||
| * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ | ||
| */ | ||
|
|
||
| import static org.junit.Assume.assumeTrue; | ||
|
|
||
| import java.io.IOException; | ||
| import java.nio.charset.StandardCharsets; | ||
| import java.nio.file.Files; | ||
| import java.nio.file.Path; | ||
|
|
||
| /** | ||
| * Shared helpers for the explicit gawk compatibility integration suites. | ||
| */ | ||
| abstract class AbstractGawkSuite { | ||
|
|
||
| protected static final Path GAWK_DIRECTORY = CompatibilityTestResources | ||
| .resourceDirectory(AbstractGawkSuite.class, "gawk"); | ||
| protected static final String NON_ZERO_TRANSCRIPT_REASON = "This case compares a non-zero gawk CLI transcript, which is intentionally skipped in the explicit AwkTestSupport.cliTest suite."; | ||
| protected static final String NON_UTF8_STDIN_REASON = "This case redirects stdin that is not valid UTF-8, which is intentionally skipped in the explicit AwkTestSupport.cliTest suite."; | ||
| protected static final String NON_UTF8_EXPECTED_REASON = "This case uses an expected .ok file that is not valid UTF-8, which is intentionally skipped in the explicit AwkTestSupport.cliTest suite."; | ||
| protected static final String MANUAL_SKIP_REASON = "Handwritten gawk case from Makefile.am not yet expressed as an AwkTestSupport.cliTest case."; | ||
|
|
||
| protected static Path gawkPath(String fileName) { | ||
| return GAWK_DIRECTORY.resolve(fileName); | ||
| } | ||
|
|
||
| protected static String gawkFile(String fileName) { | ||
| return gawkPath(fileName).toString(); | ||
| } | ||
|
|
||
| protected static String gawkText(String fileName) throws IOException { | ||
| return new String(Files.readAllBytes(gawkPath(fileName)), StandardCharsets.UTF_8); | ||
| } | ||
|
|
||
| protected static void skip(String reason) { | ||
| assumeTrue(reason, false); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -22,13 +22,9 @@ | |||||
| * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ | ||||||
| */ | ||||||
|
|
||||||
| import static org.junit.Assert.*; | ||||||
|
|
||||||
| import java.io.File; | ||||||
| import java.io.IOException; | ||||||
| import java.net.URL; | ||||||
| import java.nio.charset.StandardCharsets; | ||||||
| import java.nio.file.Files; | ||||||
| import java.nio.file.Path; | ||||||
| import java.util.Arrays; | ||||||
| import java.util.stream.Collectors; | ||||||
| import org.junit.AfterClass; | ||||||
|
|
@@ -40,90 +36,86 @@ | |||||
| import org.junit.runners.Parameterized.Parameters; | ||||||
|
|
||||||
| /** | ||||||
| * Test Suite based on unit and non-regression tests from bwk. Each AWK script | ||||||
| * in the src/test/resources/bwk.t/t.scripts directory will be executed against | ||||||
| * the corresponding *.in input, and its output will be compared to the | ||||||
| * corresponding *.ok file. | ||||||
| * Integration suite based on BWK miscellaneous compatibility tests. Each AWK | ||||||
| * script in the BWK compatibility resources executes against its corresponding | ||||||
| * input file and its output is compared with the recorded result. | ||||||
| * | ||||||
| * @see <a href="https://github.com/onetrueawk/awk">One True Awk</a> | ||||||
| */ | ||||||
| @RunWith(Parameterized.class) | ||||||
| public class BwkMiscTest { | ||||||
| public class BwkMiscIT { | ||||||
|
|
||||||
| private static final String BWK_MISC_PATH = "/bwk/misc"; | ||||||
| private static File bwkMiscDirectory; | ||||||
| private static File scriptsDirectory; | ||||||
| private static Path bwkMiscDirectory; | ||||||
| private static Path scriptsDirectory; | ||||||
|
|
||||||
| /** | ||||||
| * Initialization of the tests | ||||||
| * Initializes the BWK miscellaneous integration suite. | ||||||
| * | ||||||
| * @throws Exception | ||||||
| * @throws Exception when resource discovery fails | ||||||
| */ | ||||||
| @BeforeClass | ||||||
| public static void beforeAll() throws Exception {} | ||||||
|
|
||||||
| /** | ||||||
| * @return the list of awk scripts in /src/test/resources/gawk | ||||||
| * @throws Exception | ||||||
| * Returns the BWK miscellaneous script names discovered from the | ||||||
| * integration-test resources. | ||||||
| * | ||||||
| * @return the parameter values for this suite | ||||||
| * @throws Exception when resource discovery fails | ||||||
| */ | ||||||
| @Parameters(name = "BWK.misc {0}") | ||||||
| public static Iterable<String> awkList() throws Exception { | ||||||
| // Get the /bwk resource directory | ||||||
| URL bwkTUrl = BwkTTest.class.getResource(BWK_MISC_PATH); | ||||||
| if (bwkTUrl == null) { | ||||||
| throw new IOException("Couldn't find resource " + BWK_MISC_PATH); | ||||||
| } | ||||||
| bwkMiscDirectory = new File(bwkTUrl.toURI()); | ||||||
| if (!bwkMiscDirectory.isDirectory()) { | ||||||
| throw new IOException(BWK_MISC_PATH + " is not a directory"); | ||||||
| bwkMiscDirectory = CompatibilityTestResources.resourceDirectory(BwkMiscIT.class, "bwk", "misc"); | ||||||
| if (!bwkMiscDirectory.toFile().isDirectory()) { | ||||||
| throw new IOException(bwkMiscDirectory + " is not a directory"); | ||||||
| } | ||||||
| scriptsDirectory = new File(bwkMiscDirectory, "scripts"); | ||||||
| if (!scriptsDirectory.isDirectory()) { | ||||||
| scriptsDirectory = bwkMiscDirectory.resolve("scripts"); | ||||||
| if (!scriptsDirectory.toFile().isDirectory()) { | ||||||
| throw new IOException("scripts is not a directory"); | ||||||
| } | ||||||
| File[] scriptFiles = scriptsDirectory.toFile().listFiles(); | ||||||
| if (scriptFiles == null) { | ||||||
| throw new IOException("Couldn't list files in " + scriptsDirectory); | ||||||
| } | ||||||
|
|
||||||
| return Arrays | ||||||
| .stream(scriptsDirectory.listFiles()) | ||||||
| .filter(sf -> sf.getName().endsWith(".awk")) | ||||||
| .stream(scriptFiles) | ||||||
| .filter(scriptFile -> scriptFile.getName().endsWith(".awk")) | ||||||
|
||||||
| .filter(scriptFile -> scriptFile.getName().endsWith(".awk")) | |
| .filter(scriptFile -> scriptFile.isFile() && scriptFile.getName().endsWith(".awk")) |
bertysentry marked this conversation as resolved.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.