Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

test.sh 1.6 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. # Run the CLI tool and capture the output
  4. output=$(npm run bin redteam generate -- -c test/redteam/integration/promptfooconfig.yaml)
  5. echo "Done running promptfoo redteam generate"
  6. # Check if error log exists and display contents if it does
  7. if [ -f "promptfoo-errors.log" ]; then
  8. echo "ERROR: promptfoo-errors.log exists:"
  9. cat "promptfoo-errors.log"
  10. exit 1
  11. else
  12. echo "Confirmed: No promptfoo-errors.log file exists"
  13. fi
  14. # Check for expected output patterns
  15. if echo "$output" | grep -q "Wrote 24 test cases to redteam.yaml"; then
  16. echo "Expected line (Wrote 24 test cases to redteam.yaml) found for promptfoo redteam generate"
  17. else
  18. echo "ERROR: Expected line (Wrote 24 test cases to redteam.yaml) not found in output."
  19. echo "$output"
  20. exit 1
  21. fi
  22. echo "Running promptfoo redteam eval"
  23. export PROMPTFOO_AUTHOR="ci-placeholder@promptfoo.dev"
  24. output=$(npm run bin redteam eval) || {
  25. exit_code=$?
  26. if [ $exit_code -eq 100 ]; then
  27. echo "Got exit code 100 - this is acceptable"
  28. else
  29. echo "Command failed with exit code $exit_code"
  30. exit $exit_code
  31. fi
  32. }
  33. echo "Done running promptfoo redteam eval"
  34. echo "Checking for errors in promptfoo-errors.log"
  35. if [ -f "promptfoo-errors.log" ]; then
  36. echo "ERROR: promptfoo-errors.log exists:"
  37. cat "promptfoo-errors.log"
  38. exit 1
  39. else
  40. echo "Confirmed: No promptfoo-errors.log file exists"
  41. fi
  42. if echo "$output" | grep -q "Errors: 0"; then
  43. echo "Expected line found (Errors: 0) for promptfoo redteam eval"
  44. else
  45. echo "ERROR: Expected line (Errors: 0) not found in output."
  46. echo "$output"
  47. exit 1
  48. fi
  49. echo "All checks passed!"
  50. exit 0
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...