Files
mars-nwe/tests/linux/CMakeLists.txt
OpenAI 7241a28393
All checks were successful
Source release / source-package (push) Successful in 50s
nwconn: implement AFP DOS name reverse lookup
Implement the WebSDK/NWAFP Get DOS Name From Entry ID subfunction (NCP 0x2222/35/18) as a conservative, read-only reverse lookup over mars_nwe's existing volume and AFP metadata infrastructure.

The documented request carries a volume number and 32-bit Macintosh directory entry ID, and the reply returns a length-prefixed DOS path string.  mars_nwe's current AFP entry IDs are not the namespace base handles maintained by namspace.c; they are mars_nwe/libatalk AFP metadata IDs cached through nwatalk.  Reuse the existing volume table as the search root and nwatalk_get_entry_id() as the identity probe instead of inventing a parallel namespace handle mapping.

The reverse lookup deliberately does not create fallback IDs while walking the volume.  It only matches entries that already have mars_nwe or Netatalk AFP metadata, which is the normal smoke-test sequence after Get Entry ID, Get File Information, or Scan File Information has cached the target ID.  This keeps the lookup read-only and avoids populating entry-id xattrs across an entire volume as a side effect.

Add a Linux afp_dos_name_smoke helper and wire it into the AFP smoke suite.  The helper can resolve the supplied VOL:PATH to an entry ID first, then sends the 0x12 request and verifies the returned path without the volume prefix.  The suite continues to exercise the existing path-backed AFP compatibility flow before future create/rename/remove work.

Tests:\n- git diff --check\n- bash -n tests/linux/afp_smoke_suite.sh\n- gcc -Iinclude -I/mnt/data/stubs -fsyntax-only tests/linux/afp_dos_name_smoke.c\n\nTODO:\n- Replace the volume walk with a real CNID/base-ID index when persistent AFP identity storage grows one.\n- Return true DOS 8.3 aliases once the AFP reverse lookup is wired to the namespace alias helpers rather than preserving the cached path component spelling.
2026-05-30 16:08:30 +02:00

72 lines
2.6 KiB
CMake

# Optional Linux-side integration tests.
#
# These helpers are not built by default because they depend on the host
# ncpfs/libncp development files and on a running NetWare-compatible server.
find_path(NCPFS_INCLUDE_DIR
NAMES ncp/nwcalls.h ncp/ncplib.h
)
find_library(NCPFS_LIBRARY
NAMES ncp
)
if(NOT NCPFS_INCLUDE_DIR OR NOT NCPFS_LIBRARY)
message(FATAL_ERROR
"MARS_NWE_BUILD_LINUX_TESTS requires ncpfs/libncp headers and libncp. "
"Install the ncpfs development package or disable MARS_NWE_BUILD_LINUX_TESTS."
)
endif()
set(AFP_SMOKE_SUITE_SCRIPT
${CMAKE_CURRENT_BINARY_DIR}/afp_smoke_suite.sh
)
add_custom_command(
OUTPUT ${AFP_SMOKE_SUITE_SCRIPT}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_SOURCE_DIR}/afp_smoke_suite.sh
${AFP_SMOKE_SUITE_SCRIPT}
COMMAND ${CMAKE_COMMAND} -E env chmod +x ${AFP_SMOKE_SUITE_SCRIPT}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/afp_smoke_suite.sh
COMMENT "Copying AFP smoke-suite helper"
VERBATIM
)
add_custom_target(afp_smoke_suite ALL
DEPENDS ${AFP_SMOKE_SUITE_SCRIPT}
)
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES
${AFP_SMOKE_SUITE_SCRIPT}
)
add_executable(afp_entry_id_smoke afp_entry_id_smoke.c)
target_include_directories(afp_entry_id_smoke PRIVATE ${NCPFS_INCLUDE_DIR})
target_link_libraries(afp_entry_id_smoke ${NCPFS_LIBRARY})
add_executable(afp_file_info_smoke afp_file_info_smoke.c)
target_include_directories(afp_file_info_smoke PRIVATE ${NCPFS_INCLUDE_DIR})
target_link_libraries(afp_file_info_smoke ${NCPFS_LIBRARY})
add_executable(afp_dos_name_smoke afp_dos_name_smoke.c)
target_include_directories(afp_dos_name_smoke PRIVATE ${NCPFS_INCLUDE_DIR})
target_link_libraries(afp_dos_name_smoke ${NCPFS_LIBRARY})
add_executable(afp_scan_info_smoke afp_scan_info_smoke.c)
target_include_directories(afp_scan_info_smoke PRIVATE ${NCPFS_INCLUDE_DIR})
target_link_libraries(afp_scan_info_smoke ${NCPFS_LIBRARY})
add_executable(afp_open_file_fork_smoke afp_open_file_fork_smoke.c)
target_include_directories(afp_open_file_fork_smoke PRIVATE ${NCPFS_INCLUDE_DIR})
target_link_libraries(afp_open_file_fork_smoke ${NCPFS_LIBRARY})
add_executable(afp_temp_dir_handle_smoke afp_temp_dir_handle_smoke.c)
target_include_directories(afp_temp_dir_handle_smoke PRIVATE ${NCPFS_INCLUDE_DIR})
target_link_libraries(afp_temp_dir_handle_smoke ${NCPFS_LIBRARY})
add_executable(afp_set_file_info_smoke afp_set_file_info_smoke.c)
target_include_directories(afp_set_file_info_smoke PRIVATE ${NCPFS_INCLUDE_DIR})
target_link_libraries(afp_set_file_info_smoke ${NCPFS_LIBRARY})