Skip to content

Commit

Permalink
Merge pull request #15 from replayio/dominik/pro-864-6a-test-initial-…
Browse files Browse the repository at this point in the history
…runtime-data-hypotheses

Automatically collect call graph from `tdd_repro` (behind a comment)
  • Loading branch information
Domiii authored Oct 21, 2024
2 parents 6b6a971 + 1f8caf2 commit ac66cfe
Show file tree
Hide file tree
Showing 13 changed files with 911 additions and 58 deletions.
12 changes: 7 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Our re-organized logs.
# Our re-organized logs
sanitized_logs
investigation-data
/investigation-data

_backup/**

# their logs.
# their logs
logs
trajectories/**
!trajectories/demonstrations/**
trajectories/**


# Other
Expand All @@ -15,6 +16,8 @@ service-account-key.json
**/investigations/investigation-data
**/investigations/run-logs*
*~
/*.log
*tmp.log*

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -74,7 +77,6 @@ coverage.xml
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
Expand Down
22 changes: 11 additions & 11 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"python.terminal.activateEnvironment": true,
"python.defaultInterpreterPath": "<workspaceFolder>/.venv/bin/python",
"peacock.color": "#15141f",
"peacock.remoteColor": "#15141f",
"peacock.color": "#2b283d",
"peacock.remoteColor": "#2b283d",
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#2a283e",
"activityBar.background": "#2a283e",
"activityBar.activeBackground": "#413c5c",
"activityBar.background": "#413c5c",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#744f4b",
"activityBarBadge.background": "#000000",
"activityBarBadge.foreground": "#e7e7e7",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#2a283e",
"statusBar.background": "#15141f",
"sash.hoverBorder": "#413c5c",
"statusBar.background": "#2b283d",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#2a283e",
"statusBarItem.remoteBackground": "#15141f",
"statusBarItem.hoverBackground": "#413c5c",
"statusBarItem.remoteBackground": "#2b283d",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#15141f",
"titleBar.activeBackground": "#2b283d",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#15141f99",
"titleBar.inactiveBackground": "#2b283d99",
"titleBar.inactiveForeground": "#e7e7e799"
},
}
10 changes: 4 additions & 6 deletions config/_tdd_repro_prompt.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
## Requirements
# Requirements

* You are provided `tdd_*` tools to reproduce the issue with one or more golden tests and also check for regressions.
* Always start your investigations from the failing test.
* When deciding to investigate some part of the code, EXPLAIN CLEARLY why you think that this is the next step to take.
* Don't submit until the reproduction command proves your fix.

## HOW TO BEGIN
To start things off, run the 'tdd_repro' command to reproduce the issue.
* IMPORTANT: Always FIRST RUN the `tdd_repro` command to reproduce the issue.
* This provides you with in-depth test failure and runtime information.
* This includes `CALL_GRAPH_ON_EXCEPTION`: It contains the entire call hierarchy of all functions from that test.
20 changes: 19 additions & 1 deletion config/commands/_tdd.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# @yaml
# docstring: Reproduces the current bug by running a test that was designed to fail as long as the bug exists.
# tdd: true
# signature: tdd_repro ["<target_file>"] ["<target_function_name>"] [<decl_lineno>]
# docstring: Reproduces the bug by running bug-specific tests. Provide optional target arguments to get runtime context for the target function.
# arguments:
# target_file:
# type: string
# description: The file containing the target function, relative to CWD. If provided, target_function_name is also required.
# required: false
# target_function_name:
# type: string
# description: The UNQUALIFIED(!) name of the target function or method.
# required: false
# decl_lineno:
# type: integer
# description: The lineno of target_function's declaration. Only required if target_function_name is ambiguous within the file.
# required: false
tdd_repro() {
# set -euo pipefail
if [ -z "$TEST_CMD_FAIL_TO_PASS" ]; then
Expand All @@ -9,6 +23,10 @@ tdd_repro() {
fi
pushd $REPO_ROOT > /dev/null
echo -e "Running tests to reproduce the bug (from $PWD):\n >$TEST_CMD_FAIL_TO_PASS\n"
if [ $# -ge 1 ]; then
line_no=${3:-0}
export TDD_TRACE_TARGET_CONFIG="{ \"target_file\": \"$1\", \"target_function_name\": \"$2\", \"decl_lineno\": $line_no}"
fi
eval "$TEST_CMD_FAIL_TO_PASS"

# include the continuation file if it exists
Expand Down
5 changes: 2 additions & 3 deletions config/commands/defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,8 @@ create() {
# arguments:
# command:
# type: string
# description: Shell command string to execute. Will execute with `eval "$@"`.
# required: truewith $PWD.
# required: false
# description: Shell command string to execute. Executes `eval "$@"`.
# required: true
exec() {
if [ $# -eq 0 ]; then
echo "Usage: exec <command>"
Expand Down
Loading

0 comments on commit ac66cfe

Please sign in to comment.