summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2019-08-29 01:45:10 +0000
committerDavide Italiano <davide@freebsd.org>2019-08-29 01:45:10 +0000
commit54b3aa91d0ad0d021d416c4b6366d1f8d230d2e0 (patch)
tree86841fa0851ef7253ade84645c555fb92e9bb45f /lldb/packages/Python/lldbsuite
parenta633d29ba18b98511855f5a42cda3630306bdd13 (diff)
downloadbcm5719-llvm-54b3aa91d0ad0d021d416c4b6366d1f8d230d2e0.tar.gz
bcm5719-llvm-54b3aa91d0ad0d021d416c4b6366d1f8d230d2e0.zip
[python] remove testsuite vestiges.
llvm-svn: 370287
Diffstat (limited to 'lldb/packages/Python/lldbsuite')
-rw-r--r--lldb/packages/Python/lldbsuite/test/attic/dotest.pl44
-rw-r--r--lldb/packages/Python/lldbsuite/test/attic/tester.py149
2 files changed, 0 insertions, 193 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/attic/dotest.pl b/lldb/packages/Python/lldbsuite/test/attic/dotest.pl
deleted file mode 100644
index f093ed8f8f2..00000000000
--- a/lldb/packages/Python/lldbsuite/test/attic/dotest.pl
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/perl -w
-
-#
-# Use this script to visit each python test case under the specified directory
-# and invoke unittest.main() on each test case.
-#
-
-use strict;
-use FindBin;
-use File::Find;
-use File::Basename;
-use Cwd;
-use Cwd 'abs_path';
-
-scalar(@ARGV) == 1 or die "Usage: dotest.pl testdir";
-
-my $scriptDir = $FindBin::Bin;
-my $baseDir = abs_path("$scriptDir/..");
-my $pluginDir = "$baseDir/test/plugins";
-my $testDir = $ARGV[0];
-
-my $dbgPath = "$baseDir/build/Debug/LLDB.framework/Resources/Python";
-my $relPath = "$baseDir/build/Release/LLDB.framework/Resources/Python";
-if (-d $dbgPath) {
- $ENV{'PYTHONPATH'} = "$dbgPath:$scriptDir:$pluginDir";
-} elsif (-d $relPath) {
- $ENV{'PYTHONPATH'} = "$relPath:$scriptDir:$pluginDir";
-}
-#print("ENV{PYTHONPATH}=$ENV{'PYTHONPATH'}\n");
-
-# Traverse the directory to find our python test cases.
-find(\&handleFind, $testDir);
-
-sub handleFind {
- my $foundFile = $File::Find::name;
- my $dir = getcwd;
- #print("foundFile: $foundFile\n");
-
- # Test*.py is the naming pattern for our test cases.
- if ($foundFile =~ /.*\/(Test.*\.py)$/) {
- print("Running python $1 (cwd = $dir)...\n");
- system("python $1");
- }
-}
diff --git a/lldb/packages/Python/lldbsuite/test/attic/tester.py b/lldb/packages/Python/lldbsuite/test/attic/tester.py
deleted file mode 100644
index 2e783512369..00000000000
--- a/lldb/packages/Python/lldbsuite/test/attic/tester.py
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf8 -*-
-
-from __future__ import print_function
-
-import math
-import os.path
-import re
-import sys
-import time
-import unittest
-
-
-def setupSysPath():
- testPath = sys.path[0]
- rem = re.match("(^.*/)test$", testPath)
- if not rem:
- print("This script expects to reside in .../test.")
- sys.exit(-1)
- lldbBasePath = rem.group(1)
- lldbDebugPythonPath = "build/Debug/LLDB.framework/Resources/Python"
- lldbReleasePythonPath = "build/Release/LLDB.framework/Resources/Python"
- lldbPythonPath = None
- if os.path.isfile(lldbDebugPythonPath + "/lldb.py"):
- lldbPythonPath = lldbDebugPythonPath
- if os.path.isfile(lldbReleasePythonPath + "/lldb.py"):
- lldbPythonPath = lldbReleasePythonPath
- if not lldbPythonPath:
- print(
- "This script requires lldb.py to be in either " +
- lldbDebugPythonPath,
- end='')
- print("or" + lldbReleasePythonPath)
- sys.exit(-1)
- sys.path.append(lldbPythonPath)
-
-
-def prettyTime(t):
- if t == 0.0:
- return "0s"
- if t < 0.000001:
- return ("%.3f" % (t * 1000000000.0)) + "ns"
- if t < 0.001:
- return ("%.3f" % (t * 1000000.0)) + "µs"
- if t < 1:
- return ("%.3f" % (t * 1000.0)) + "ms"
- return str(t) + "s"
-
-
-class ExecutionTimes:
-
- @classmethod
- def executionTimes(cls):
- if cls.m_executionTimes is None:
- cls.m_executionTimes = ExecutionTimes()
- for i in range(100):
- cls.m_executionTimes.start()
- cls.m_executionTimes.end("null")
- return cls.m_executionTimes
-
- def __init__(self):
- self.m_times = dict()
-
- def start(self):
- self.m_start = time.time()
-
- def end(self, component):
- e = time.time()
- if component not in self.m_times:
- self.m_times[component] = list()
- self.m_times[component].append(e - self.m_start)
-
- def dumpStats(self):
- for key in list(self.m_times.keys()):
- if len(self.m_times[key]):
- sampleMin = float('inf')
- sampleMax = float('-inf')
- sampleSum = 0.0
- sampleCount = 0.0
- for time in self.m_times[key]:
- if time > sampleMax:
- sampleMax = time
- if time < sampleMin:
- sampleMin = time
- sampleSum += time
- sampleCount += 1.0
- sampleMean = sampleSum / sampleCount
- sampleVariance = 0
- for time in self.m_times[key]:
- sampleVariance += (time - sampleMean) ** 2
- sampleVariance /= sampleCount
- sampleStandardDeviation = math.sqrt(sampleVariance)
- print(
- key +
- ": [" +
- prettyTime(sampleMin) +
- ", " +
- prettyTime(sampleMax) +
- "] ",
- end='')
- print(
- "µ " +
- prettyTime(sampleMean) +
- ", σ " +
- prettyTime(sampleStandardDeviation))
- m_executionTimes = None
-
-setupSysPath()
-
-import lldb
-
-
-class LLDBTestCase(unittest.TestCase):
-
- def setUp(self):
- debugger = lldb.SBDebugger.Create()
- debugger.SetAsync(True)
- self.m_commandInterpreter = debugger.GetCommandInterpreter()
- if not self.m_commandInterpreter:
- print("Couldn't get the command interpreter")
- sys.exit(-1)
-
- def runCommand(self, command, component):
- res = lldb.SBCommandReturnObject()
- ExecutionTimes.executionTimes().start()
- self.m_commandInterpreter.HandleCommand(command, res, False)
- ExecutionTimes.executionTimes().end(component)
- if res.Succeeded():
- return res.GetOutput()
- else:
- self.fail("Command " + command + " returned an error")
- return None
-
- def getCategories(self):
- return []
-
-
-class SanityCheckTestCase(LLDBTestCase):
-
- def runTest(self):
- ret = self.runCommand("show arch", "show-arch")
- # print(ret)
-
- def getCategories(self):
- return []
-
-suite = unittest.TestLoader().loadTestsFromTestCase(SanityCheckTestCase)
-unittest.TextTestRunner(verbosity=2).run(suite)
-ExecutionTimes.executionTimes().dumpStats()
OpenPOWER on IntegriCloud