Skip to content

Commit 913479d

Browse files
committed
refactor: Update test script prompt and logging for improved clarity and functionality
1 parent c9a7844 commit 913479d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

internal/llm/prompts.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ You *MUST NOT* include any other text, explanations, or markdown formatting.
3838

3939
// TestScriptPrompt is used to generate the test script
4040
TestScriptPrompt = `You are an expert in testing shell scripts with extensive experience in test automation and quality assurance.
41-
Your goal is to create a comprehensive test script that verifies the functionality of the main script, including edge cases and error conditions.
41+
Your goal is to create a test script that verifies the functionality of the main script, ./script.sh, including edge cases and error conditions.
4242
4343
Create a test script for the following script:
4444
@@ -56,13 +56,15 @@ Target platform Information:
5656
</target_platform>
5757
5858
<requirements>
59-
- Create a test script that runs one or more test cases to make sure the main script works as expected
59+
- Create a test script that runs one or more test cases to make sure that ./script.sh works as expected
6060
- Each test case should:
6161
- Set up the test environment
6262
- Run the main script with test inputs
6363
- Verify the output matches expectations
64-
- Clean up after the test
64+
- Clean up after the test only if necessary
6565
- Use standard shell commands (sh/bash) with POSIX compliance where possible
66+
- The test script should not need any arguments to run
67+
- Return exit code 0 if all tests pass, or 1 if any test fails
6668
- Set appropriate timeouts for any long-running tests
6769
- Handle environment variables and cleanup
6870
- Ensure platform compatibility

internal/script/pipeline.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,14 @@ func (p *Pipeline) runTestScript(ctx context.Context, scripts llm.ScriptPair) er
152152
cmd.Dir = testDir
153153

154154
output, err := cmd.CombinedOutput()
155+
log.Debug("Test script output:\n%s", output)
155156
if err != nil {
157+
if exitErr, ok := err.(*exec.ExitError); ok {
158+
log.Debug("Test script exited with code: %d", exitErr.ExitCode())
159+
}
156160
return fmt.Errorf("test script failed: %w\nOutput:\n%s", err, output)
157161
}
158-
159-
// Log test script output in verbose mode
160-
log.Debug("Test script output:\n%s", output)
162+
log.Debug("Test script exited with code: 0")
161163

162164
return nil
163165
}

0 commit comments

Comments
 (0)