zturner created this revision. zturner added reviewers: labath, tfiala. zturner added a subscriber: lldb-commits.
I'm trying to get the LLDB buildbot to run tests, and currently the issue is that many tests fail when trying to write the session log file. The build directory on the buildbot is already nested kind of deep, which means the path to clang.exe is also deep, and having this in the filename results in paths that are 400+ characters long, which don't work well in Windows. To fix this, I'm allowing the specification of a custom file format, where you can specify various fields to be included in the filename. The default behavior of dotest is unchanged, it will still display everything it's always displayed. But if you're using CMake then the default will be to not include the compiler path. This is because by default CMake also uses only runs tests with one compiler anyway, so the compiler path is not needed to distinguish identical tests run with different compilers. http://reviews.llvm.org/D20306 Files: packages/Python/lldbsuite/test/configuration.py packages/Python/lldbsuite/test/dosep.py packages/Python/lldbsuite/test/dotest.py packages/Python/lldbsuite/test/dotest_args.py packages/Python/lldbsuite/test/lldbtest.py test/CMakeLists.txt
Index: test/CMakeLists.txt =================================================================== --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -27,6 +27,10 @@ ${LLDB_DEFAULT_TEST_ARCH} CACHE STRING "Specify the architecture to run LLDB tests as (x86|x64). Determines whether tests are compiled with -m32 or -m64") +set(LLDB_TEST_LOG_FORMAT + -S;nm + CACHE STRING "Specify the format of the session log file. See lldbsuite/test/configuration.py for more detail.") + # Users can override LLDB_TEST_USER_ARGS to specify arbitrary arguments to pass to the script set(LLDB_TEST_USER_ARGS -C ${LLDB_TEST_COMPILER} @@ -62,7 +66,7 @@ add_python_test_target(check-lldb-single ${LLDB_SOURCE_DIR}/test/dotest.py - "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}" + "--no-multiprocess;${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_LOG_FORMAT};${LLDB_TEST_USER_ARGS}" "Testing LLDB with args: ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}" ) @@ -72,6 +76,6 @@ # output is desired (i.e. in continuous integration contexts) check-lldb-single is a better target. add_python_test_target(check-lldb ${LLDB_SOURCE_DIR}/test/dotest.py - "${LLDB_DOTEST_ARGS}" + "${LLDB_TEST_LOG_FORMAT};${LLDB_DOTEST_ARGS}" "Testing LLDB (parallel execution, with a separate subprocess per test)" ) Index: packages/Python/lldbsuite/test/lldbtest.py =================================================================== --- packages/Python/lldbsuite/test/lldbtest.py +++ packages/Python/lldbsuite/test/lldbtest.py @@ -962,19 +962,27 @@ if not os.path.isdir(dname): os.mkdir(dname) - compiler = self.getCompiler() - - if compiler[1] == ':': - compiler = compiler[2:] - if os.path.altsep is not None: - compiler = compiler.replace(os.path.altsep, os.path.sep) - - fname = "{}-{}-{}".format(self.id(), self.getArchitecture(), "_".join(compiler.split(os.path.sep))) - if len(fname) > 200: - fname = "{}-{}-{}".format(self.id(), self.getArchitecture(), compiler.split(os.path.sep)[-1]) - + components = [] if prefix is not None: - fname = "{}-{}".format(prefix, fname) + components.append(prefix) + for c in configuration.session_file_format: + if c == 'f': + components.append(self.__class__.__module__) + elif c == 'n': + components.append(self.__class__.__name__) + elif c == 'c': + compiler = self.getCompiler() + + if compiler[1] == ':': + compiler = compiler[2:] + if os.path.altsep is not None: + compiler = compiler.replace(os.path.altsep, os.path.sep) + components.extend([x for x in compiler.split(os.path.sep) if x != ""]) + elif c == 'a': + components.append(self.getArchitecture()) + elif c == 'm': + components.append(self.testMethodName) + fname = "-".join(components) return os.path.join(dname, fname) Index: packages/Python/lldbsuite/test/dotest_args.py =================================================================== --- packages/Python/lldbsuite/test/dotest_args.py +++ packages/Python/lldbsuite/test/dotest_args.py @@ -70,6 +70,7 @@ group.add_argument('--framework', metavar='framework-path', help='The path to LLDB.framework') group.add_argument('--executable', metavar='executable-path', help='The path to the lldb executable') group.add_argument('-s', metavar='name', help='Specify the name of the dir created to store the session files of tests with errored or failed status. If not specified, the test driver uses the timestamp as the session dir name') + group.add_argument('-S', metavar='format', help='Specify session file name format. See configuration.py for a description. Default="fnmac"') group.add_argument('-y', type=int, metavar='count', help="Specify the iteration count used to collect our benchmarks. An example is the number of times to do 'thread step-over' to measure stepping speed.") group.add_argument('-#', type=int, metavar='sharp', dest='sharp', help='Repeat the test suite for a specified number of times') group.add_argument('--channel', metavar='channel', dest='channels', action='append', help=textwrap.dedent("Specify the log channels (and optional categories) e.g. 'lldb all' or 'gdb-remote packets' if no categories are specified, 'default' is used")) Index: packages/Python/lldbsuite/test/dotest.py =================================================================== --- packages/Python/lldbsuite/test/dotest.py +++ packages/Python/lldbsuite/test/dotest.py @@ -321,6 +321,8 @@ if args.s.startswith('-'): usage(parser) configuration.sdir_name = args.s + if args.S: + configuration.session_file_format = args.S if args.t: os.environ['LLDB_COMMAND_TRACE'] = 'YES' Index: packages/Python/lldbsuite/test/dosep.py =================================================================== --- packages/Python/lldbsuite/test/dosep.py +++ packages/Python/lldbsuite/test/dosep.py @@ -423,9 +423,11 @@ if dotest_options.p and not re.search(dotest_options.p, base_name): continue + session_format = dotest_options.S if dotest_options.S is not None else configuration.session_file_format script_file = main.__file__ command = ([sys.executable, script_file] + dotest_argv + + ["-S", session_format] + ["--inferior", "-p", base_name, root]) timeout_name = os.path.basename(os.path.splitext(base_name)[0]).upper() Index: packages/Python/lldbsuite/test/configuration.py =================================================================== --- packages/Python/lldbsuite/test/configuration.py +++ packages/Python/lldbsuite/test/configuration.py @@ -100,6 +100,15 @@ # run. Use '-s session-dir-name' to specify a specific dir name. sdir_name = None +# Valid options: +# f - test file name (without extension) +# n - test class name +# m - test method name +# a - architecture +# c - compiler path +# The default is to write all fields. +session_file_format = 'fnmac' + # Set this flag if there is any session info dumped during the test run. sdir_has_content = False
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits