Bug 1531951 - Clean up some test code warnings and switch to python3 for print(flush=True). r=jonco

Differential Revision: https://phabricator.services.mozilla.com/D46548

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Steve Fink 2019-09-30 03:57:06 +00:00
parent 5d5b232ad8
commit 1162b03ed0
5 changed files with 20 additions and 16 deletions

View File

@ -3,6 +3,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import print_function
import os
import site
import subprocess
@ -100,8 +102,7 @@ for name in cfg.tests:
os.chdir(outdir)
for xdb in glob("*.xdb"):
os.unlink(xdb)
if cfg.verbose:
print("Running test %s" % name)
print("START TEST {}".format(name), flush=True)
testpath = os.path.join(indir, "test.py")
testscript = open(testpath).read()
testcode = compile(testscript, testpath, 'exec')

View File

@ -79,14 +79,18 @@ void usecontainer(T* value) {
if (value) asm("");
}
Cell* cell() {
static Cell c;
return &c;
}
Cell* f() {
GCInDestructor kaboom;
Cell cell;
Cell* cell1 = &cell;
Cell* cell2 = &cell;
Cell* cell3 = &cell;
Cell* cell4 = &cell;
Cell* cell1 = cell();
Cell* cell2 = cell();
Cell* cell3 = cell();
Cell* cell4 = cell();
{
AutoSuppressGC nogc;
suppressedFunction();
@ -102,7 +106,7 @@ Cell* f() {
AutoSuppressGC nogc;
}
usecell(cell3);
Cell* cell5 = &cell;
Cell* cell5 = cell();
usecell(cell5);
{
@ -123,7 +127,7 @@ Cell* f() {
}
// Hazard in return value due to ~GCInDestructor
Cell* cell6 = &cell;
Cell* cell6 = cell();
return cell6;
}

View File

@ -50,10 +50,12 @@ class Test(object):
return os.path.join(self.cfg.sixgill_bin, prog)
def compile(self, source, options=''):
env = os.environ
env['CCACHE_DISABLE'] = '1'
cmd = "{CXX} -c {source} -O3 -std=c++11 -fplugin={sixgill} -fplugin-arg-xgill-mangle=1 {options}".format( # NOQA: E501
source=self.infile(source),
CXX=self.cfg.cxx, sixgill=self.cfg.sixgill_plugin,
options=options)
options=options, env=env)
if self.cfg.verbose:
print("Running %s" % cmd)
subprocess.check_call(["sh", "-c", cmd])

View File

@ -39,9 +39,9 @@ class Base {
ANNOTATE("static func") ANNOTATE("second func");
};
float Base::testAnnotations() { asm(""); }
float Base::testAnnotations() { asm(""); return 1.1; }
double Base::testParamAnnotations(Cell& cell) { asm(""); }
double Base::testParamAnnotations(Cell& cell) { asm(""); return 1.2; }
class Super : public Base {
public:

View File

@ -17,10 +17,7 @@ export LD_LIBRARY_PATH="$GCCDIR/lib64"
export RUSTC="$MOZ_FETCHES_DIR/rustc/bin/rustc"
export CARGO="$MOZ_FETCHES_DIR/rustc/bin/cargo"
PYTHON=python2.7
if ! which $PYTHON; then
PYTHON=python
fi
PYTHON=python3
function check_commit_msg () {
( set +e;