From 776a7bbb1282295a4b62d35b4ee7418fad024501 Mon Sep 17 00:00:00 2001 From: KangLin Date: Mon, 3 Jun 2019 10:06:55 +0800 Subject: [PATCH] Add test --- App/App.pro | 2 +- App/CMakeLists.txt | 2 +- App/Resource/Resource.qrc | 2 +- .../image/{calendar.png => LunarCalendar.png} | Bin LunarCalendar.pro | 1 + ci/build.sh | 31 ++++++++------- debian/LunarCalendar.desktop | 2 +- debian/postinst | 2 +- test/test_linux.sh | 36 ++++++++++++++++++ 9 files changed, 57 insertions(+), 21 deletions(-) rename App/Resource/image/{calendar.png => LunarCalendar.png} (100%) create mode 100755 test/test_linux.sh diff --git a/App/App.pro b/App/App.pro index 843345c4..f5d83565 100644 --- a/App/App.pro +++ b/App/App.pro @@ -129,7 +129,7 @@ win32 { # install icons icon.target = icon - icon.files = Resource/image/calendar.png + icon.files = Resource/image/LunarCalendar.png icon.path = $${PREFIX}/share/pixmaps icon.CONFIG = directory no_check_exist INSTALLS += DESKTOP_FILE icon diff --git a/App/CMakeLists.txt b/App/CMakeLists.txt index 4addf3fc..9e1d0f9f 100644 --- a/App/CMakeLists.txt +++ b/App/CMakeLists.txt @@ -80,7 +80,7 @@ INSTALL(FILES ${OTHER_FILES} DESTINATION ".") if(UNIX) INSTALL(FILES ${CMAKE_SOURCE_DIR}/debian/LunarCalendar.desktop DESTINATION "share/applications") - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Resource/image/calendar.png DESTINATION "share/pixmaps") + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/Resource/image/LunarCalendar.png DESTINATION "share/pixmaps") endif() IF("Release" STREQUAL CMAKE_BUILD_TYPE AND WIN32) diff --git a/App/Resource/Resource.qrc b/App/Resource/Resource.qrc index 160bb3a7..03f867fa 100644 --- a/App/Resource/Resource.qrc +++ b/App/Resource/Resource.qrc @@ -1,5 +1,5 @@ - image/calendar.png + image/LunarCalendar.png diff --git a/App/Resource/image/calendar.png b/App/Resource/image/LunarCalendar.png similarity index 100% rename from App/Resource/image/calendar.png rename to App/Resource/image/LunarCalendar.png diff --git a/LunarCalendar.pro b/LunarCalendar.pro index df79cb9d..e308ca02 100644 --- a/LunarCalendar.pro +++ b/LunarCalendar.pro @@ -59,4 +59,5 @@ OTHER_FILES += appveyor.yml \ Install/* \ Update/* \ debian/* \ + test/* \ build_debpackage.sh diff --git a/ci/build.sh b/ci/build.sh index a41c40c8..2bc288fb 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -79,25 +79,24 @@ esac if [ "${BUILD_TARGERT}" = "unix" ]; then cd $SOURCE_DIR - if [ "$BUILD_DOWNLOAD" = "TRUE" ]; then - bash build_debpackage.sh ${QT_ROOT} - else - bash build_debpackage.sh ${QT_ROOT} - - if [ "$TRAVIS_TAG" != "" -a "${QT_VERSION_DIR}" = "512" ]; then - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/debian/lunarcalendar/opt/LunarCalendar/bin - MD5=`md5sum ../lunarcalendar*_amd64.deb|awk '{print $1}'` - echo "MD5:${MD5}" - ./debian/lunarcalendar/opt/LunarCalendar/bin/LunarCalendarApp \ + bash build_debpackage.sh ${QT_ROOT} + + sudo dpkg -i ../lunarcalendar*_amd64.deb + $SOURCE_DIR/test/test_linux.sh + + if [ "$TRAVIS_TAG" != "" -a "${QT_VERSION_DIR}" = "512" ]; then + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/debian/lunarcalendar/opt/LunarCalendar/bin + MD5=`md5sum ../lunarcalendar*_amd64.deb|awk '{print $1}'` + echo "MD5:${MD5}" + ./debian/lunarcalendar/opt/LunarCalendar/bin/LunarCalendarApp \ -f "`pwd`/update_linux.xml" \ --md5 ${MD5} - export UPLOADTOOL_BODY="Release LunarCalendar-${VERSION}" - #export UPLOADTOOL_PR_BODY= - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh - bash upload.sh ../lunarcalendar*_amd64.deb update_linux.xml - fi - + export UPLOADTOOL_BODY="Release LunarCalendar-${VERSION}" + #export UPLOADTOOL_PR_BODY= + wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh + bash upload.sh ../lunarcalendar*_amd64.deb update_linux.xml fi + if [ "$TRAVIS_TAG" != "" -a "${QT_VERSION_DIR}" = "512" ]; then cd debian/lunarcalendar/opt/LunarCalendar diff --git a/debian/LunarCalendar.desktop b/debian/LunarCalendar.desktop index 2dfa70b2..18be423a 100755 --- a/debian/LunarCalendar.desktop +++ b/debian/LunarCalendar.desktop @@ -6,7 +6,7 @@ Comment=Lunar calendar Name[zh_CN]=日历 GenericName[zh_CN]=日历 Comment[zh_CN]=日历(包含农历) -Icon=calendar +Icon=LunarCalendar Exec=/opt/LunarCalendar/bin/LunarCalendarApp Terminal=false StartupNotify=true diff --git a/debian/postinst b/debian/postinst index 9abd23c6..2d5a9de4 100644 --- a/debian/postinst +++ b/debian/postinst @@ -27,7 +27,7 @@ case "$1" in if [ ! -d /usr/share/pixmaps ]; then mkdir -p /usr/share/pixmaps fi - ln -s /opt/LunarCalendar/share/pixmaps/calendar.png /usr/share/pixmaps/calendar.png + ln -s /opt/LunarCalendar/share/pixmaps/LunarCalendar.png /usr/share/pixmaps/LunarCalendar.png fi echo "/opt/LunarCalendar/lib" > /etc/ld.so.conf.d/LunarCalendar.conf echo "/opt/LunarCalendar/bin" >> /etc/ld.so.conf.d/LunarCalendar.conf diff --git a/test/test_linux.sh b/test/test_linux.sh new file mode 100755 index 00000000..607ccb53 --- /dev/null +++ b/test/test_linux.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +EXIT_CODE=0 +PROJECT_NAME="LunarCalendar" + +if [ -n "$1" ]; then + echo "$PROJECT_NAME" + PROJECT_NAME=$1 +fi + +if [ ! -f /opt/share/applications/${PROJECT_NAME}.desktop ]; then + echo "There are not /opt/share/applications/${PROJECT_NAME}.desktop" + EXIT_CODE=$[EXIT_CODE+1] +fi + +if [ ! -f /usr/share/applications/${PROJECT_NAME}.desktop ]; then + echo "There are not /usr/share/applications/${PROJECT_NAME}.desktop" + EXIT_CODE=$[EXIT_CODE+1] +fi + +if [ ! -f /opt/share/pixmaps/${PROJECT_NAME}.png ]; then + echo "There are not /opt/share/pixmaps/${PROJECT_NAME}.png" + EXIT_CODE=$[EXIT_CODE+1] +fi + +if [ ! -f /usr/share/pixmaps/${PROJECT_NAME}.png ]; then + echo "There are not /usr/share/pixmaps/${PROJECT_NAME}.png" + EXIT_CODE=$[EXIT_CODE+1] +fi + +if [ ! -f /etc/ld.so.conf.d/LunarCalendar.conf ]; then + echo "There are not /etc/ld.so.conf.d/${PROJECT_NAME}.conf" + EXIT_CODE=$[EXIT_CODE+1] +fi + +exit $EXIT_CODE