Skip to content

Commit 48f1733

Browse files
committed
Use temp files for improved grepping.
1 parent 43d3107 commit 48f1733

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

rails_application/Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,22 @@ ifeq ($(origin MUTANT_NODE_INDEX), environment)
5555
echo "Perl command produced no output (expected if no files for node)."; \
5656
else \
5757
echo "--- DEBUG: Derived names (before subject filter): ---"; \
58-
echo "$$DERIVED_NAMES"; \
58+
echo "$$DERIVED_NAMES" > .derived_names.tmp; \
59+
cat .derived_names.tmp; \
5960
fi; \
6061
echo "--- END DEBUG (perl) ---"; \
62+
echo "--- DEBUG: Filtering derived names based on .mutant.yml patterns ---"; \
6163
SUBJECT_PATTERNS_RAILS_APP='^(Orders::|ClientOrders::)'; \
62-
FILTERED_NAMES=$$(echo "$$DERIVED_NAMES" | grep -E "$$SUBJECT_PATTERNS_RAILS_APP" || true); \
63-
echo "--- DEBUG: Filtered names (after subject filter to modules): ---"; \
64-
echo "$$FILTERED_NAMES"; \
65-
SUBJECT_ARGS=$$(echo "$$FILTERED_NAMES" | xargs); \
64+
if [ -f .derived_names.tmp ]; then \
65+
grep -E "$$SUBJECT_PATTERNS_RAILS_APP" .derived_names.tmp > .filtered_names.tmp || true; \
66+
else \
67+
touch .filtered_names.tmp; \
68+
fi; \
69+
FILTERED_NAMES_CONTENT=$$(cat .filtered_names.tmp); \
70+
echo "--- DEBUG: Filtered names (after subject filter to modules, from .filtered_names.tmp): ---"; \
71+
echo "$$FILTERED_NAMES_CONTENT"; \
72+
SUBJECT_ARGS=$$(cat .filtered_names.tmp | xargs); \
73+
echo "--- DEBUG: SUBJECT_ARGS for mutant: [$$SUBJECT_ARGS]"; \
6674
if [ -z "$$SUBJECT_ARGS" ]; then \
6775
echo "No subjects matching module criteria (Orders::*, ClientOrders::*) found for this node. Skipping."; \
6876
else \
@@ -74,7 +82,7 @@ ifeq ($(origin MUTANT_NODE_INDEX), environment)
7482
exit $$MUTANT_EXIT_CODE; \
7583
fi; \
7684
fi; \
77-
rm -f .all_files.tmp .node_files.tmp
85+
rm -f .all_files.tmp .node_files.tmp .derived_names.tmp .filtered_names.tmp
7886
else
7987
@echo "Running mutation tests locally for rails_application (mutant discovers subjects from .mutant.yml)"
8088
@RAILS_ENV=test bundle exec mutant run

0 commit comments

Comments
 (0)