Skip to content

Commit

Permalink
needs-restarting tests: Can't discriminate block devices any more
Browse files Browse the repository at this point in the history
We can no longer detect that block devices like /dev/dri/card0 are not
"regular files", since they have device IDs matching 00:xx, just like
other legitimate files on some systems. This should be fine since no
package should provide a file like /dev/dri/card0.

Instead, we add a test that smap entries like

```
556d60d52000-556d60e1c000 rw-p 00000000 00:00 0                          [heap]
```

are not treated as regular files (since the file path doesn't contain a /).
  • Loading branch information
evan-goode authored and kontura committed Oct 14, 2024
1 parent ddb906f commit bc50a84
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/test_needs_restarting.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@

DEL_FILE = '3dcf000000-3dcf032000 r-xp 00000000 08:02 140759 ' \
' /usr/lib64/libXfont.so.1.4.1;5408628d (deleted)'
MM_FILE = '7fc4e1168000-7fc4e1169000 rw-s 1096dd000 00:05 7749' \
' /dev/dri/card0'
HEAP_FILE = '556d60d52000-556d60e1c000 rw-p 00000000 00:00 0 [heap]'
SO_FILE = '30efe06000-30efe07000 r--p 00006000 08:02 139936' \
' /usr/lib64/libSM.so.6.0.1'
class NeedsRestartingTest(tests.support.TestCase):
def test_smap2opened_file(self):
func = needs_restarting.smap2opened_file
self.assertIsNone(func(1, 'Shared_Dirty: 0 kB'))
self.assertIsNone(func(1, MM_FILE))
self.assertIsNone(func(1, HEAP_FILE))

ofile = func(5, SO_FILE)
self.assertFalse(ofile.deleted)
Expand Down

0 comments on commit bc50a84

Please sign in to comment.