Skip to content

Commit ca176f8

Browse files
committed
Improved pearl processing.
1 parent 4d332eb commit ca176f8

File tree

2 files changed

+37
-13
lines changed

2 files changed

+37
-13
lines changed

ecommerce/pricing/Makefile

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,28 @@ MUTANT_TARGET_DIRS := lib
88

99
mutate:
1010
ifeq ($(origin MUTANT_NODE_INDEX), environment)
11-
@echo "Running mutation tests in parallel (Node $(MUTANT_NODE_INDEX)/$(MUTANT_TOTAL_NODES)) for pricing, using .mutant.yml"
12-
@find $(MUTANT_TARGET_DIRS) -path ./vendor -prune -o -name '*.rb' -print | sed 's|^\./||' > .all_files.tmp
11+
@echo "Running mutation tests in parallel (Node $$(( $(MUTANT_NODE_INDEX) + 1 ))/$(MUTANT_TOTAL_NODES)) for pricing"
12+
@echo "--- DEBUG: Finding potential subject files ---"
13+
@find $(MUTANT_TARGET_DIRS) -path ./vendor -prune -o -name '*.rb' -print > .all_files.tmp
14+
@echo "--- DEBUG: Found files count: $(shell wc -l < .all_files.tmp)"
15+
@echo "--- END DEBUG ---"
1316
@awk "NR % $(MUTANT_TOTAL_NODES) == $(MUTANT_NODE_INDEX)" .all_files.tmp > .node_files.tmp
14-
@SUBJECT_NAMES_CMD="cat .node_files.tmp | perl -pe 's|^lib/||; s|\\.rb$$||; s|/|::|g; s/\\b(\\w)/ucfirst(\$1)/ge'"
15-
@SUBJECT_ARGS=$$($$SUBJECT_NAMES_CMD | tr '\\n' ' '); \
17+
@echo "--- DEBUG: Files count for this node ($(MUTANT_NODE_INDEX)): $(shell wc -l < .node_files.tmp)"
18+
@echo "--- END DEBUG ---"
19+
@SUBJECT_NAMES_CMD="cat .node_files.tmp | perl -pe 's|^lib/||; s|\\.rb$$||; s|_([a-z])|uc(\$1)|eg; s|/|::|g; s/(?:^|::)(.)/\\u\$1/g'"
20+
@echo "--- DEBUG: Attempting to derive subject names for this node... ---"
21+
@DERIVED_NAMES=$$(eval $$SUBJECT_NAMES_CMD); \
22+
EXIT_CODE=$$?; \
23+
if [ $$EXIT_CODE -ne 0 ]; then \
24+
echo "Perl command failed with exit code $$EXIT_CODE"; \
25+
exit $$EXIT_CODE; \
26+
elif [ -z "$$DERIVED_NAMES" ]; then \
27+
echo "Perl command produced no output."; \
28+
else \
29+
echo "$$DERIVED_NAMES"; \
30+
fi
31+
@echo "--- END DEBUG ---"
32+
@SUBJECT_ARGS=$$(echo "$$DERIVED_NAMES" | tr '\\n' ' '); \
1633
if [ -z "$$SUBJECT_ARGS" ]; then \
1734
echo "No subjects derived for this node. Skipping."; \
1835
else \
@@ -21,7 +38,7 @@ ifeq ($(origin MUTANT_NODE_INDEX), environment)
2138
fi
2239
@rm -f .all_files.tmp .node_files.tmp
2340
else
24-
@echo "Running mutation tests locally (using .mutant.yml)"
41+
@echo "Running mutation tests locally for pricing (using .mutant.yml)"
2542
@RAILS_ENV=test bundle exec mutant run
2643
endif
2744

rails_application/Makefile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,25 @@ ifeq ($(origin MUTANT_NODE_INDEX), environment)
2727
-not -path 'db/*' \
2828
-not -path 'vendor/*' \
2929
-print > .all_files.tmp
30-
@echo "--- DEBUG: Found files (.all_files.tmp): ---"
31-
@cat .all_files.tmp || echo "No files found by find."
30+
@echo "--- DEBUG: Found files count: $(shell wc -l < .all_files.tmp)"
3231
@echo "--- END DEBUG ---"
3332
@awk "NR % $(MUTANT_TOTAL_NODES) == $(MUTANT_NODE_INDEX)" .all_files.tmp > .node_files.tmp
34-
@echo "--- DEBUG: Files for this node ($(MUTANT_NODE_INDEX)) (.node_files.tmp): ---"
35-
@cat .node_files.tmp || echo "No files selected for this node by awk."
33+
@echo "--- DEBUG: Files count for this node ($(MUTANT_NODE_INDEX)): $(shell wc -l < .node_files.tmp)"
3634
@echo "--- END DEBUG ---"
37-
@SUBJECT_NAMES_CMD="cat .node_files.tmp | perl -pe 's|^(app|lib)/||; s|\\.rb$$||; s|/|::|g; s/\\b(\\w)/ucfirst(\$1)/ge'"
38-
@echo "--- DEBUG: Derived subject names for this node: ---"
39-
@eval $$SUBJECT_NAMES_CMD || echo "Perl command failed or produced no output."
35+
@SUBJECT_NAMES_CMD="cat .node_files.tmp | perl -pe 's|^(app|lib)/||; s|\\.rb$$||; s|_([a-z])|uc(\$1)|eg; s|/|::|g; s/(?:^|::)(.)/\\u\$1/g'"
36+
@echo "--- DEBUG: Attempting to derive subject names for this node... ---"
37+
@DERIVED_NAMES=$$(eval $$SUBJECT_NAMES_CMD); \
38+
EXIT_CODE=$$?; \
39+
if [ $$EXIT_CODE -ne 0 ]; then \
40+
echo "Perl command failed with exit code $$EXIT_CODE"; \
41+
exit $$EXIT_CODE; \
42+
elif [ -z "$$DERIVED_NAMES" ]; then \
43+
echo "Perl command produced no output."; \
44+
else \
45+
echo "$$DERIVED_NAMES"; \
46+
fi
4047
@echo "--- END DEBUG ---"
41-
@SUBJECT_ARGS=$$($$SUBJECT_NAMES_CMD | tr '\\n' ' '); \
48+
@SUBJECT_ARGS=$$(echo "$$DERIVED_NAMES" | tr '\\n' ' '); \
4249
if [ -z "$$SUBJECT_ARGS" ]; then \
4350
echo "No subjects derived for this node. Skipping."; \
4451
else \

0 commit comments

Comments
 (0)