mirror of
https://github.com/Kitware/CMake.git
synced 2026-11-06 05:16:58 +00:00
CPack: Add test coverage for CPACK_APPIMAGE_VERSION
Verify that the `X-AppImage-Version` entry that appimagetool writes to the desktop file defaults to `CPACK_PACKAGE_VERSION` and that it can be overridden with `CPACK_APPIMAGE_VERSION`.
This commit is contained in:
1 parent
824564c7f0
commit
fb398e1000
6 files changed
+102
-3
No files matched your search
@@ -1,3 +1,3 @@
|
||||
if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/GeneratorTest-1.2.3-Linux.AppImage")
|
||||
set(RunCMake_TEST_FAILED "AppImage package not generated")
|
||||
endif()
|
||||
# CPACK_APPIMAGE_VERSION defaults to CPACK_PACKAGE_VERSION.
|
||||
set(expected_version "1.2.3")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/AppImageVersionCheck.cmake")
|
||||
@@ -0,0 +1,3 @@
|
||||
# CPACK_APPIMAGE_VERSION given explicitly overrides CPACK_PACKAGE_VERSION.
|
||||
set(expected_version "4.5.6-test")
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/AppImageVersionCheck.cmake")
|
||||
@@ -0,0 +1,19 @@
|
||||
appimagetool[^
|
||||
]*
|
||||
Using architecture x86_64
|
||||
Deleting pre-existing \.DirIcon
|
||||
Creating \.DirIcon symlink based on information from desktop file
|
||||
WARNING: AppStream upstream metadata is missing, please consider creating it
|
||||
in usr/share/metainfo/com\.example\.app\.appdata\.xml
|
||||
Please see https://www\.freedesktop\.org/software/appstream/docs/chap-Quickstart\.html#sect-Quickstart-DesktopApps
|
||||
for more information or use the generator at
|
||||
https://docs\.appimage\.org/packaging-guide/optional/appstream\.html#using-the-appstream-generator
|
||||
Generating squashfs\.\.\.
|
||||
Embedding ELF\.\.\.
|
||||
Marking the AppImage as executable\.\.\.
|
||||
Embedding MD5 digest
|
||||
Success
|
||||
|
||||
Please consider submitting your AppImage to AppImageHub, the crowd-sourced
|
||||
central directory of available AppImages, by opening a pull request
|
||||
at https://github\.com/AppImage/appimage\.github\.io
|
||||
@@ -0,0 +1,44 @@
|
||||
CPack: Create package using AppImage
|
||||
CPack: Install projects
|
||||
CPack: - Install project: CPackAppImageGenerator \[Release\]
|
||||
CPack: Create package
|
||||
CPack: AppDir: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux"
|
||||
CPack: Found Desktop file: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/share/applications/com\.example\.app\.desktop"
|
||||
CPack: Desktop file destination: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/com\.example\.app\.desktop"
|
||||
CPack: Icon file: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/share/icons/hicolor/64x64/apps/ApplicationIcon\.png"
|
||||
CPack: Icon link destination: "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux/ApplicationIcon\.png"
|
||||
CPack: No AppRun found, generating a default one that will run: "bin/app"
|
||||
CPack: Running AppImageTool: "[^"]*" "[^"]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux" "\.\./GeneratorTest-1\.2\.3-Linux\.AppImage" "--runtime-file" "[^"]*"
|
||||
[^
|
||||
]*/_CPack_Packages/Linux/AppImage/GeneratorTest-1\.2\.3-Linux should be packaged as \.\./GeneratorTest-1\.2\.3-Linux\.AppImage
|
||||
Parallel mksquashfs: Using [0-9]+ processors
|
||||
Creating 4\.0 filesystem on [^
|
||||
]*/GeneratorTest-1\.2\.3-Linux\.AppImage, block size [0-9]+\.
|
||||
.*
|
||||
Exportable Squashfs 4\.0 filesystem, zstd compressed, data block size [0-9]+
|
||||
[ ]compressed data, compressed metadata, compressed fragments,
|
||||
[ ]compressed xattrs, compressed ids
|
||||
[ ]duplicates are removed
|
||||
Filesystem size [0-9\.]+ Kbytes \([0-9\.]+ Mbytes\)
|
||||
[ ][0-9\.]+% of uncompressed filesystem size \([0-9\.]+ Kbytes\)
|
||||
Inode table size [0-9]+ bytes \([0-9\.]+ Kbytes\)
|
||||
[ ][0-9\.]+% of uncompressed inode table size \([0-9]+ bytes\)
|
||||
Directory table size [0-9]+ bytes \([0-9\.]+ Kbytes\)
|
||||
[ ][0-9\.]+% of uncompressed directory table size \([0-9]+ bytes\)
|
||||
Number of duplicate files found [0-9]+
|
||||
Number of inodes [0-9]+
|
||||
Number of files [0-9]+
|
||||
Number of fragments [0-9]+
|
||||
Number of symbolic links [0-9]+
|
||||
Number of device nodes [0-9]+
|
||||
Number of fifo nodes [0-9]+
|
||||
Number of socket nodes [0-9]+
|
||||
Number of directories [0-9]+
|
||||
Number of hard-links [0-9]+
|
||||
Number of ids \(unique uids \+ gids\) [0-9]+
|
||||
Number of uids [0-9]+
|
||||
[ ]root \([0-9]+\)
|
||||
Number of gids [0-9]+
|
||||
[ ]root \([0-9]+\)
|
||||
CPack: - package: [^
|
||||
]*/Tests/RunCMake/CPack_AppImage/AppImageVersion-build/GeneratorTest-1\.2\.3-Linux\.AppImage generated\.
|
||||
@@ -0,0 +1,28 @@
|
||||
# Shared by the *-check.cmake scripts: verify that appimagetool recorded
|
||||
# ${expected_version} as X-AppImage-Version in the package's desktop file.
|
||||
set(appimage "${RunCMake_TEST_BINARY_DIR}/GeneratorTest-1.2.3-Linux.AppImage")
|
||||
if(NOT EXISTS "${appimage}")
|
||||
set(RunCMake_TEST_FAILED "AppImage package not generated")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(extract_dir "${RunCMake_TEST_BINARY_DIR}/extract")
|
||||
file(REMOVE_RECURSE "${extract_dir}")
|
||||
file(MAKE_DIRECTORY "${extract_dir}")
|
||||
execute_process(
|
||||
COMMAND "${appimage}" --appimage-extract com.example.app.desktop
|
||||
WORKING_DIRECTORY "${extract_dir}"
|
||||
RESULT_VARIABLE extract_result
|
||||
OUTPUT_QUIET
|
||||
ERROR_VARIABLE extract_error
|
||||
)
|
||||
set(desktop_file "${extract_dir}/squashfs-root/com.example.app.desktop")
|
||||
if(NOT extract_result EQUAL 0 OR NOT EXISTS "${desktop_file}")
|
||||
set(RunCMake_TEST_FAILED "Failed to extract desktop file from AppImage: ${extract_result}\n${extract_error}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(STRINGS "${desktop_file}" actual_version REGEX "^X-AppImage-Version=")
|
||||
if(NOT actual_version STREQUAL "X-AppImage-Version=${expected_version}")
|
||||
set(RunCMake_TEST_FAILED "Expected 'X-AppImage-Version=${expected_version}' in desktop file, got: '${actual_version}'")
|
||||
endif()
|
||||
@@ -13,3 +13,8 @@ block()
|
||||
list(APPEND RunCMake_TEST_OPTIONS -DCUSTOM_APPRUN=ON)
|
||||
run_cpack(AppImageCustomAppRun SAMPLE AppImageUsrPrefix BUILD)
|
||||
endblock()
|
||||
|
||||
block()
|
||||
list(APPEND RunCMake_TEST_OPTIONS "-DCPACK_APPIMAGE_VERSION=4.5.6-test")
|
||||
run_cpack(AppImageVersion SAMPLE AppImageTestApp BUILD)
|
||||
endblock()
|
||||
Reference in new issue
Block a user