Skip to content

Commit

Permalink
flit_disguise: remove --fields and add --jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebentley15 committed Oct 4, 2020
1 parent 8b80cbb commit 9591f60
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions scripts/flitcli/flit_disguise.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
import argparse
import csv
import glob
import multiprocessing as mp
import os
import re
import subprocess as subp
Expand Down Expand Up @@ -148,20 +149,15 @@ def populate_parser(parser=None):
analysis done by someone with the anonymized
file(s).
''')
parser.add_argument('--fields', default='file,function,test',
parser.add_argument('-j', '--jobs', default=None,
help='''
A comma-separated list of fields you want to
disguise. This will not effect the generated
disguise map, all fields will be present there. It
will just impact the disguising and the undo
operations.
Available fields are
(1) "file": source file name and file path
(including compiled object file(s)),
(2) "function": function name, both mangled and
demangled, and
(3) "test": name of the test.
When generating the disguise map, we may need to
compile the gtrun executable using the
autogenerated flit Makefile. This flag specifies
the number of jobs to give to GNU make. The
default behavior is to defer to the MAKEFLAGS
environment variable. If that variable is not set,
then we will use the number of processors.
''')
parser.add_argument('file', nargs='?',
help='''
Expand All @@ -176,11 +172,18 @@ def populate_parser(parser=None):
''')
return parser

def generate_disguise_map(outfile='disguise.csv'):
def generate_disguise_map(outfile='disguise.csv', jobs=None):
'Generate the disguise map, often called from the Makefile'

if not jobs and not hasattr(os.environ, 'MAKEFLAGS'):
jobs = mp.cpu_count()

# make sure gtrun is compiled
subp.check_call(['make', 'gtrun'])
make_args = ['make', 'gtrun']
if jobs:
make_args.append('-j{}'.format(jobs))
subp.check_call(make_args)

makevars = util.extract_make_vars()

# get list of source files
Expand Down

0 comments on commit 9591f60

Please sign in to comment.