Skip to content

Commit

Permalink
Use /proc/self/mounts instead of /etc/mtab.
Browse files Browse the repository at this point in the history
  • Loading branch information
mithrandi committed Oct 6, 2015
1 parent 966b5f3 commit f5ac354
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion epsilon/scripts/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down
17 changes: 9 additions & 8 deletions epsilon/test/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand Down

0 comments on commit f5ac354

Please sign in to comment.