-
-
Notifications
You must be signed in to change notification settings - Fork 741
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for
process_lookup_path
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* collision.c | ||
* -*- mode: c -*- | ||
* -*- coding: utf-8 -*- | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
|
||
|
||
int main(int argc, char** argv, char** envp) | ||
{ | ||
printf("Hello World!\n"); | ||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import pytest | ||
|
||
from tests.base import RemoteGefUnitTestGeneric | ||
from tests.utils import debug_target | ||
|
||
|
||
class RegressionFilenameCollisionLookup(RemoteGefUnitTestGeneric): | ||
"""Tests for regression about collisions in filenames while using | ||
`process_lookup_path` | ||
""" | ||
|
||
def setUp(self) -> None: | ||
self._target = debug_target("collision-libc/collision") | ||
return super().setUp() | ||
|
||
def test_process_lookup_path_use_only_filename(self): | ||
root, gdb = self._conn.root, self._gdb | ||
|
||
gdb.execute("start") | ||
program = root.eval("process_lookup_path('collision')") | ||
libc = root.eval("process_lookup_path('libc')") | ||
|
||
print(program) | ||
print(libc) | ||
|
||
assert program is not None | ||
assert libc is not None | ||
# TODO: Check if we can compare sections directly | ||
assert program.page_start != libc.page_start |