From f5ac3543f25e3c96187cfd1561e32f87ef644174 Mon Sep 17 00:00:00 2001 From: Tristan Seligmann Date: Tue, 6 Oct 2015 09:32:54 +0200 Subject: [PATCH] Use /proc/self/mounts instead of /etc/mtab. --- epsilon/scripts/benchmark.py | 2 +- epsilon/test/test_benchmark.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/epsilon/scripts/benchmark.py b/epsilon/scripts/benchmark.py index 708a369..ae5f4aa 100644 --- a/epsilon/scripts/benchmark.py +++ b/epsilon/scripts/benchmark.py @@ -423,7 +423,7 @@ def discoverCurrentWorkingDevice(): """ possibilities = [] cwd = os.getcwd() - for L in file('/etc/mtab'): + for L in file('/proc/self/mounts'): parts = L.split() if cwd.startswith(parts[1]): possibilities.append((len(parts[1]), parts[0])) diff --git a/epsilon/test/test_benchmark.py b/epsilon/test/test_benchmark.py index 6b41b79..c938822 100644 --- a/epsilon/test/test_benchmark.py +++ b/epsilon/test/test_benchmark.py @@ -16,16 +16,17 @@ try: filepath.FilePath('/proc/diskstats').open().close() + filepath.FilePath('/proc/self/mounts').open().close() except IOError: - hasDiskstats = False + hasProc = False else: - hasDiskstats = True + hasProc = True class DiskstatTestCase(unittest.TestCase): - if not hasDiskstats: - skip = 'epsilon.benchmark requires access to /proc/diskstats' + if not hasProc: + skip = 'epsilon.benchmark requires access to /proc' def testDiskLineParser(self): @@ -406,8 +407,8 @@ def cbKilled(exc): class SnapshotTestCase(unittest.TestCase): - if not hasDiskstats: - skip = 'epsilon.benchmark requires access to /proc/diskstats' + if not hasProc: + skip = 'epsilon.benchmark requires access to /proc' def testStart(self): @@ -424,8 +425,8 @@ def testStop(self): class BenchmarkProcessTestCase(SpawnMixin, unittest.TestCase): - if not hasDiskstats: - skip = 'epsilon.benchmark requires access to /proc/diskstats' + if not hasProc: + skip = 'epsilon.benchmark requires access to /proc' processProtocol = benchmark.BenchmarkProcess