Skip to content

Commit

Permalink
Fix memleaks testing warnings for with --warn-unstable (chapel-lang…
Browse files Browse the repository at this point in the history
…#23320)

[reviewed by @vasslitvinov]

Because the `--memLeaks` flag is unstable, when we use it in our
nightly memleaks job on tests that use the `--warn-unstable` flag,
extra output is generated.  Fix that

<details>

To fix that, add a prediff script that will be used for the
single locale and multilocale memleaks jobs.  This script will
explicitly remove the memLeaks warning from from tests that
encounter it.

</details>

There are two tests that intentionally throw both of these flags
together normally.  Unfortunately, that means that they would
generate an extra error, which would cause them to fail.  So,
skip them when the flag is thrown generally (which is fine,
because what it would otherwise be testing is already handled
in the default nightly setting, as a result of those flags being
always provided to those tests) - this involved splitting the
memLeaks config test away from the other config tests.

Passed full memleaks testing with futures (aside from some
tests that don't run in nightly memleaks testing), when the
environment variable that nightly will use is set.
  • Loading branch information
lydia-duncan authored Sep 12, 2023
2 parents 5a93ea0 + 1600b70 commit 99e8618
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 2 deletions.
3 changes: 3 additions & 0 deletions test/statements/manage/WarnUnstable.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# because we already explicitly throw memleaks, we'll get duplicate warnings
# due to the flag being unstable
EXECOPTS <= memLeaks
1 change: 0 additions & 1 deletion test/unstable/unstableConfigs.execopts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
--myUnstableConfig=12 --myUserConfig=1 #unstableConfigs.good
--printModuleInitOrder=false #unstableConfigs.initorder.good
--dataParTasksPerLocale=2 --dataParIgnoreRunningTasks=false --dataParMinGranularity=10 #unstableConfigs.datapar.good
--memTrack=true --memStats=true --memLeaksByType=true --memLeaks=true --memMax=0 --memThreshold=0 --memLog="log" --memLeaksLog="leaklog" --memLeaksByDesc=" " #unstableConfigs.mem.good
--debugGpu=true --gpuNoCpuModeWarning=true --enableGpuP2P=true #unstableConfigs.gpu.good
12 changes: 12 additions & 0 deletions test/unstable/unstableConfigs.mem.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
config var myUserConfig = 0;

@unstable("Hey it's unstable!")
config var myUnstableConfig = 0;


config param myUserParam = 0;


writeln(myUserConfig);
writeln(myUnstableConfig);
writeln(myUserParam);
1 change: 1 addition & 0 deletions test/unstable/unstableConfigs.mem.execopts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--memTrack=true --memStats=true --memLeaksByType=true --memLeaks=true --memMax=0 --memThreshold=0 --memLog="log" --memLeaksLog="leaklog" --memLeaksByDesc=" "
2 changes: 1 addition & 1 deletion test/unstable/unstableConfigs.mem.good
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
unstableConfigs.chpl:XX: warning: Hey it's unstable!
unstableConfigs.mem.chpl:11: warning: Hey it's unstable!
0
0
0
Expand Down
3 changes: 3 additions & 0 deletions test/unstable/unstableConfigs.mem.skipif
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# because we already explicitly throw memleaks, we'll get duplicate warnings
# due to the flag being unstable
EXECOPTS <= memLeaks
1 change: 1 addition & 0 deletions util/cron/common-memleaks.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Configure environment for memory leaks testing. This should be sourced by
# other scripts that wish to make use of the variables set here.

export CHPL_SYSTEM_PREDIFF=$CHPL_HOME/util/test/prediff-for-unstable-memleaks
export CHPL_NIGHTLY_MEMLEAKS_DIR=${CHPL_NIGHTLY_MEMLEAKS_DIR:-$PERF_LOGDIR_PREFIX/NightlyMemLeaks}
export MEM_LEAKS_DATE_VAL=$(date '+%Y-%m-%d')

Expand Down
20 changes: 20 additions & 0 deletions util/test/prediff-for-unstable-memleaks
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3

# want to eliminate the message
# `<command-line arg>:n: warning: The variable 'memLeaks' is unstable and its interface is subject to change in the future`
# from tests that don't normally provide it when in the general memleaks config

import sys

testname = sys.argv[1]
outfile = sys.argv[2]

memleaksWarn = "warning: The variable 'memLeaks' is unstable and its interface is subject to change in the future"

with open(outfile, 'r', newline='') as outR:
myLines = outR.readlines()

with open(outfile, 'w', newline='') as overwrite:
for line in myLines:
if line.find(memleaksWarn) == -1:
overwrite.write(line)

0 comments on commit 99e8618

Please sign in to comment.