Skip to content

Commit a4c090b

Browse files
committed
Addressing Comments.
1. Add comments related to documentation for check-asan target. 2. Ensure that check-asan target should only be executed for smoke-asan tests.
1 parent 1a37dfa commit a4c090b

3 files changed

Lines changed: 69 additions & 49 deletions

File tree

test/smoke-asan/Makefile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@ run run_obin run_sbin run_llbin clean clean_log llbin sbin obin:
2323
$(MAKE) -C $$test_dir $@; \
2424
done
2525

26-
check:
27-
@for test_dir in $(TESTS_DIR); do \
28-
echo $$nnn; \
29-
test_name=`grep "TESTNAME *=" $$test_dir/Makefile | sed "s/.*= *//"`; \
30-
echo "TEST_DIR: $$test_dir\tTEST_NAME: $$test_name\tMAKE: $(MAKE) -C $$test_dir $@"; \
31-
$(MAKE) -C $$test_dir $@; \
32-
done
26+
check: check-asan
27+
28+
check-asan:
29+
@for test_dir in $(TESTS_DIR); do \
30+
echo $$nnn; \
31+
test_name=`grep "TESTNAME *=" $$test_dir/Makefile | sed "s/.*= *//"`; \
32+
echo "TEST_DIR: $$test_dir\tTEST_NAME: $$test_name\tMAKE: $(MAKE) -C $$test_dir $@"; \
33+
$(MAKE) -C $$test_dir $@; \
34+
done
3335

3436
.ll .ll.s .ll.o .s .s.o .o:
3537
@for test_dir in $(TESTS_DIR); do \

test/smoke/Makefile.rules

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -128,51 +128,69 @@ endif
128128
check-asan: $(TESTNAME)
129129
ifneq (,$(findstring $(GPU_W_FEATURES),$(SUPPORTED)))
130130
ifeq (,$(findstring $(GPU_W_FEATURES),$(UNSUPPORTED)))
131-
path=`pwd`; \
132-
base=`basename $$path`; \
133-
( \
134-
flock -e 9 && echo "" >> ../check-smoke-asan.txt; \
135-
declare -A CmdStatus; \
136-
pipeline="$(RUNENV) $(SMOKE_TIMEOUT) $(RUNPROF) $(RUNPROF_FLAGS) $(CHECK_COMMAND) > /dev/null 2>&1"; \
137-
$(RUNENV) $(SMOKE_TIMEOUT) $(RUNPROF) $(RUNPROF_FLAGS) $(CHECK_COMMAND) > /dev/null 2>&1; \
138-
pstat=($${PIPESTATUS[@]}); \
139-
function GetPipedCmdStatus() { \
140-
Cmd="$$2"; \
141-
CmdRunIndex="$$3"; \
142-
CmdRunIndexList=($$(echo $$1 | awk -F'|' '{for(i=1;i<=NF;i++) {gsub(/^[ \t]+|[ \t]+$$/, "", $$i); print $$i}}' | awk -v Cmd_Pattern="$$Cmd " '$$0~Cmd_Pattern {print NR}')); \
143-
for CmdIndex in "$${CmdRunIndexList[@]}"; do \
144-
if [ -v CmdStatus["$$Cmd"] ]; then \
145-
ArrString=$${CmdStatus["$$Cmd"]}; \
146-
ArrString+=",$${pstat[$$CmdIndex-1]}"; \
147-
CmdStatus["$$Cmd"]=$${ArrString}; \
148-
else \
149-
NewArrString=$${pstat[$$CmdIndex-1]}; \
150-
CmdStatus["$$Cmd"]=$${NewArrString}; \
151-
fi; \
152-
done; \
153-
if [ -v CmdStatus[$$Cmd] ] && [ $$CmdRunIndex -gt 0 ];then \
154-
IFS=',' read -ra CmdStatusList <<< "$${CmdStatus[$$Cmd]}"; \
155-
return $${CmdStatusList["$$CmdRunIndex"-1]}; \
156-
fi; \
157-
}; \
158-
GetPipedCmdStatus "$$pipeline" "$(TESTNAME)" "1"; \
159-
test_status=$$?; \
160-
GetPipedCmdStatus "$$pipeline" "FileCheck" "1"; \
161-
filecheck_status=$$?; \
162-
echo "$$test_status" > TEST_STATUS; \
163-
echo "$$filecheck_status" > FILECHECK_STATUS; \
164-
echo $$base $$test_num return code: $$test_status >> ../check-smoke-asan.txt; \
165-
echo "" >> ../check-smoke-asan.txt; \
166-
if [ $$filecheck_status -eq 0 ]; then echo $$base $$test_num >> ../passing-tests.txt; \
167-
else echo $$base $$test_num >> ../failing-tests.txt; fi; \
168-
)9>../lockfile;
131+
path=`pwd`; \
132+
base=`basename $$path`; \
133+
( \
134+
flock -e 9 && echo "" >> ../check-smoke-asan.txt; \
135+
# CmdStatus: Associative Container which keeps track of execution status of any command in the pipeline. \
136+
declare -A CmdStatus; \
137+
# GetPipedCmdStatus: Function which on demand populates the CmdStatus container with execution status values of each command executing in a given input pipeline. \
138+
# param_1: pipeline as string. \
139+
# param_2: pipestatus computed from PIPESTATUS as array. \
140+
# param_3: Cmd Name as string. \
141+
# param_4: CmdRunIndex of Cmd as positive integer. \
142+
function GetPipedCmdStatus() { \
143+
# pstat: Piped command status list. \
144+
local -n pstat=$$2; \
145+
# Cmd: Command Name \
146+
Cmd="$$3"; \
147+
# CmdRunIndex: Index value of Cmd executing in the pipeline. \
148+
# Ex. pipeline = "Cmd1 | Cmd2 | Cmd3 | Cmd1 | Cmd4 | Cmd3" \
149+
# CmdRunIndex of Cmd1(First Time): 1 \
150+
# CmdRunIndex of Cmd2(First Time): 1 \
151+
# CmdRunIndex of Cmd1(Second Time): 4 \
152+
CmdRunIndex="$$4"; \
153+
# CmdRunIndexList: Index List of each Cmd. \
154+
# Ex. pipeline = "Cmd1 | Cmd2 | Cmd1 | Cmd3" \
155+
# CmdRunIndexList of Cmd1: (1,3) \
156+
CmdRunIndexList=($$(echo $$1 | awk -F'|' '{for(i=1;i<=NF;i++) {gsub(/^[ \t]+|[ \t]+$$/, "", $$i); print $$i}}' | awk -v Cmd_Pattern="$$Cmd " '$$0~Cmd_Pattern {print NR}')); \
157+
for CmdIndex in "$${CmdRunIndexList[@]}"; do \
158+
if [ -v CmdStatus["$$Cmd"] ]; then \
159+
ArrString=$${CmdStatus["$$Cmd"]}; \
160+
ArrString+=",$${pstat[$$CmdIndex-1]}"; \
161+
CmdStatus["$$Cmd"]=$${ArrString}; \
162+
else \
163+
NewArrString=$${pstat[$$CmdIndex-1]}; \
164+
CmdStatus["$$Cmd"]=$${NewArrString}; \
165+
fi; \
166+
done; \
167+
if [ -v CmdStatus[$$Cmd] ] && [ $$CmdRunIndex -gt 0 ];then \
168+
IFS=',' read -ra CmdStatusList <<< "$${CmdStatus[$$Cmd]}"; \
169+
return $${CmdStatusList["$$CmdRunIndex"-1]}; \
170+
fi; \
171+
}; \
172+
pipeline="$(RUNENV) $(SMOKE_TIMEOUT) $(RUNPROF) $(RUNPROF_FLAGS) $(CHECK_COMMAND) > /dev/null 2>&1"; \
173+
$(RUNENV) $(SMOKE_TIMEOUT) $(RUNPROF) $(RUNPROF_FLAGS) $(CHECK_COMMAND) > /dev/null 2>&1; \
174+
pipestatus=($${PIPESTATUS[@]}); \
175+
GetPipedCmdStatus "$$pipeline" "pipestatus" "$(TESTNAME)" "1"; \
176+
test_status=$$?; \
177+
GetPipedCmdStatus "$$pipeline" "pipestatus" "FileCheck" "1"; \
178+
filecheck_status=$$?; \
179+
echo "$$test_status" > TEST_STATUS; \
180+
echo "$$filecheck_status" > FILECHECK_STATUS; \
181+
echo $$base $$test_num return code: $$test_status >> ../check-smoke-asan.txt; \
182+
echo "" >> ../check-smoke-asan.txt; \
183+
if [ $$filecheck_status -eq 0 ]; then echo $$base $$test_num >> ../passing-tests.txt; \
184+
else echo $$base $$test_num >> ../failing-tests.txt; fi; \
185+
)9>../lockfile;
169186
else
170-
@echo " $(SKIP_RUN_UNSUPPORTED)"
187+
@echo " $(SKIP_RUN_UNSUPPORTED)"
171188
endif
172189
else
173-
@echo " $(SKIP_RUN_SUPPORTED)"
190+
@echo " $(SKIP_RUN_SUPPORTED)"
174191
endif
175192

193+
176194
# ----- Demo compile and link to object file
177195
ifneq ($(TESTNAME), $(findstring $(TESTNAME),$(TESTNAMES_ALL)))
178196
.PHONY: $(TESTNAME).o

test/smoke/check_smoke.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ if [ "$AOMP_PARALLEL_SMOKE" == 1 ]; then
242242
sem --jobs 4 --id def_sem -u 'base=$(basename $(pwd)); make check > /dev/null; if [ $? -ne 0 ]; then flock -e lockfile -c "echo $base: Make Failed >> ../make-fail.txt"; fi;'
243243
elif [ $base == "gpus" ]; then # Compile and link only test
244244
echo gpus is compile only!
245-
elif [ "$AOMP_SANITIZER" == 1 ]; then
245+
elif [ "$AOMP_SANITIZER" == 1 ] && [ "$SMOKE_DIRS" == "smoke-asan" ]; then
246246
sem --jobs 4 --id def_sem -u 'make check-asan > /dev/null 2>&1'
247247
else
248248
sem --jobs 4 --id def_sem -u 'make check > /dev/null 2>&1'
@@ -337,7 +337,7 @@ for directory in $SMOKE_DIRS; do
337337
echo "$base" >> ../passing-tests.txt
338338
elif [ $base == 'printf_parallel_for_target' ] || [ $base == 'omp_places' ] || [ $base == 'pfspecifier' ] || [ $base == 'pfspecifier_str' ] ; then
339339
make verify-log
340-
elif [ "$AOMP_SANITIZER" == 1 ]; then
340+
elif [ "$AOMP_SANITIZER" == 1 ] && [ "$SMOKE_DIRS" == "smoke-asan" ]; then
341341
make check-asan > /dev/null 2>&1
342342
else
343343
make check > /dev/null 2>&1

0 commit comments

Comments
 (0)