Skip to content

Commit

Permalink
apacheGH-35361: [C++] Remove Perl dependency from cpp/build-support/r…
Browse files Browse the repository at this point in the history
…un-test.sh (apache#35362)

### Rationale for this change

Because Perl in conda doesn't work on Manjaro Linux.

### What changes are included in this PR?

* Use `sed` instead of `perl`.
* Remove `stacktrace_addr2line.pl`. If we still need it, we can re-implement the addr2line filter in other language such as Python or shell later.

### Are these changes tested?

Yes by hand on Manjaro Linux.

### Are there any user-facing changes?

No.
* Closes: apache#35361

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
kou authored and liujiacheng777 committed May 11, 2023
1 parent 7f5cf36 commit 2f87365
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 103 deletions.
21 changes: 10 additions & 11 deletions cpp/build-support/run-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ TEST_DIRNAME=$(cd $(dirname $1); pwd)
TEST_FILENAME=$(basename $1)
shift
TEST_EXECUTABLE="$TEST_DIRNAME/$TEST_FILENAME"
TEST_NAME=$(echo $TEST_FILENAME | perl -pe 's/\..+?$//') # Remove path and extension (if any).
TEST_NAME=$(echo $TEST_FILENAME | sed -E -e 's/\..+$//') # Remove path and extension (if any).

# We run each test in its own subdir to avoid core file related races.
TEST_WORKDIR=$OUTPUT_ROOT/build/test-work/$TEST_NAME
Expand Down Expand Up @@ -97,7 +97,6 @@ function run_test() {
cat $LOGFILE.raw \
| ${PYTHON:-python} $ROOT/build-support/asan_symbolize.py \
| ${CXXFILT:-c++filt} \
| $ROOT/build-support/stacktrace_addr2line.pl $TEST_EXECUTABLE \
| $pipe_cmd 2>&1 | tee $LOGFILE
rm -f $LOGFILE.raw

Expand Down Expand Up @@ -157,15 +156,15 @@ function post_process_tests() {
# case result to the XML file for the leak report. Otherwise Jenkins won't show
# us which tests had LSAN errors.
if grep -E -q "ERROR: LeakSanitizer: detected memory leaks" $LOGFILE ; then
echo Test had memory leaks. Editing XML
perl -p -i -e '
if (m#</testsuite>#) {
print "<testcase name=\"LeakSanitizer\" status=\"run\" classname=\"LSAN\">\n";
print " <failure message=\"LeakSanitizer failed\" type=\"\">\n";
print " See txt log file for details\n";
print " </failure>\n";
print "</testcase>\n";
}' $XMLFILE
echo Test had memory leaks. Editing XML
sed -i.bak -e '/<\/testsuite>/ i\
<testcase name="LeakSanitizer" status="run" classname="LSAN">\
<failure message="LeakSanitizer failed" type="">\
See txt log file for details\
</failure>\
</testcase>' \
$XMLFILE
mv $XMLFILE.bak $XMLFILE
fi
}

Expand Down
92 changes: 0 additions & 92 deletions cpp/build-support/stacktrace_addr2line.pl

This file was deleted.

0 comments on commit 2f87365

Please sign in to comment.