Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Reset NetHack by overriding rw segments of dynamic library in memory. #312

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ jobs:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: 'win/rl src/nle.c sys/unix/nledl.c include/nle.h include/nledl.h include/nleobs.h'
source: 'win/rl src/nle.c include/nle.h include/nleinstance.h include/dloverride.h include/nleobs.h sys/unix/rlmain.cc'
clangFormatVersion: 12
13 changes: 12 additions & 1 deletion .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,19 @@ jobs:
submodules: true
- name: Install from repo in test mode
run: "pip install -e '.[dev]'"
- name: Run dyld_info
run: "dyldinfo `python -c 'from nle.nethack import nethack; print(nethack.DLPATH)'` || echo 0"
- name: Run otool
run: "otool -l `python -c 'from nle.nethack import nethack; print(nethack.DLPATH)'` || echo 0"
- name: Setup upterm session
uses: lhotari/action-upterm@v1
with:
## limits ssh access and adds the ssh public key for the user which triggered the workflow
limit-access-to-actor: true
## limits ssh access and adds the ssh public keys of the listed GitHub users
limit-access-to-users: heiner,tscmoo
- name: Run tests
run: "python -m pytest -svx nle/tests --basetemp=nle_test_data"
run: "DYLD_PRINT_SEGMENTS=1 python -m pytest -svx nle/tests --basetemp=nle_test_data"
- name: Compress test output dir
if: ${{ always() }}
run: |
Expand Down
17 changes: 7 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,12 @@ target_link_directories(nethack PUBLIC /usr/local/lib)

target_link_libraries(nethack PUBLIC m fcontext bz2)

# dlopen wrapper library
add_library(nethackdl STATIC "sys/unix/nledl.c")
target_include_directories(nethackdl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(nethackdl PUBLIC dl)

# rlmain C++ (test) binary
add_executable(rlmain "sys/unix/rlmain.cc")
set_target_properties(rlmain PROPERTIES CXX_STANDARD 11)
target_link_libraries(rlmain PUBLIC nethackdl)
target_include_directories(rlmain PUBLIC ${NLE_INC_GEN})
set_target_properties(rlmain PROPERTIES CXX_STANDARD 14)
target_link_libraries(rlmain PUBLIC dl)
target_include_directories(rlmain PUBLIC ${NLE_INC_GEN}
${CMAKE_CURRENT_SOURCE_DIR}/include)
add_dependencies(rlmain util) # For pm.h.

# pybind11 python library.
Expand All @@ -141,7 +137,8 @@ pybind11_add_module(
src/drawing.c
src/objects.c
$<TARGET_OBJECTS:tile>)
target_link_libraries(_pynethack PUBLIC nethackdl)
target_link_libraries(_pynethack PUBLIC dl)
set_target_properties(_pynethack PROPERTIES CXX_STANDARD 14)
target_include_directories(_pynethack PUBLIC ${NLE_INC_GEN})
target_include_directories(
_pynethack PUBLIC ${NLE_INC_GEN} ${CMAKE_CURRENT_SOURCE_DIR}/include)
add_dependencies(_pynethack util) # For pm.h.
Loading