From aea231bbc00358b7e96dc933f4e73e7ef3a97c47 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sun, 15 Jun 2025 23:38:04 +0800 Subject: [PATCH] Rename to `deb-installation-test.sh` --- .github/workflows/pkg-deb.yml | 12 +++---- pkg/DEB/BUILD.md | 2 +- pkg/DEB/README.md | 2 +- pkg/DEB/deb-installation-test.sh | 55 ++++++++++++++++++++++++++++++++ pkg/DEB/deb-test.sh | 43 ------------------------- 5 files changed, 61 insertions(+), 53 deletions(-) create mode 100644 pkg/DEB/deb-installation-test.sh delete mode 100755 pkg/DEB/deb-test.sh diff --git a/.github/workflows/pkg-deb.yml b/.github/workflows/pkg-deb.yml index 9186a13..58e701c 100644 --- a/.github/workflows/pkg-deb.yml +++ b/.github/workflows/pkg-deb.yml @@ -110,18 +110,14 @@ jobs: - name: Test package installation run: | version="${{ steps.get_version.outputs.version }}" + # Install the package sudo dpkg -i dist/chsrc_${version}-1_amd64.deb || true sudo apt-get install -f -y || true - # Run basic tests - if [ -f "pkg/DEB/deb-test.sh" ]; then - sudo bash pkg/DEB/deb-test.sh - else - # Basic manual test - chsrc help - echo "Package installation test passed!" - fi + # Run DEB installation tests + bash pkg/DEB/deb-installation-test.sh + - name: Upload DEB artifact uses: actions/upload-artifact@v4 diff --git a/pkg/DEB/BUILD.md b/pkg/DEB/BUILD.md index 88b5f72..4cf63fd 100644 --- a/pkg/DEB/BUILD.md +++ b/pkg/DEB/BUILD.md @@ -78,7 +78,7 @@ sudo apt-get install -f # 修复依赖问题 ```bash # 运行测试 -./deb-test.sh +bash ./deb-installation-test.sh # 查看文档安装情况 man chsrc diff --git a/pkg/DEB/README.md b/pkg/DEB/README.md index 330b10f..31f2cd9 100644 --- a/pkg/DEB/README.md +++ b/pkg/DEB/README.md @@ -27,7 +27,7 @@ - `debian/` - DEB 包构建配置目录 - `BUILD.md` - 如何手动构建 - `deb.makefile` - DEB 包构建 Makefile -- `deb-test.sh` - DEB 包 **已正确安装** 测试脚本 +- `deb-installation-test.sh` - DEB 包 **已正确安装** 测试脚本
diff --git a/pkg/DEB/deb-installation-test.sh b/pkg/DEB/deb-installation-test.sh new file mode 100644 index 0000000..ebd00c9 --- /dev/null +++ b/pkg/DEB/deb-installation-test.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# -------------------------------------------------------------- +# SPDX-License-Identifier: GPL-3.0-or-later +# -------------------------------------------------------------- +# Test File : deb-installation-test.sh +# File Authors : sanchuanhehe +# Contributors : Aoran Zeng +# | +# Created On : <2025-06-14> +# Last Modified : <2025-06-15> +# +# Test script for DEB package installation +# -------------------------------------------------------------- + +set -e + +echo "Testing installation of DEB package 'chsrc' ..." + +# Test 1: Check if chsrc binary exists and is executable +if [ ! -f "/usr/bin/chsrc" ]; then + echo "ERROR: /usr/bin/chsrc not found" + exit 1 +fi + +if [ ! -x "/usr/bin/chsrc" ]; then + echo "ERROR: /usr/bin/chsrc is not executable" + exit 1 +fi + +echo "✓ /usr/bin/chsrc binary exists and is executable" + +# Test 2: Check if man page exists +if [ ! -f "/usr/share/man/man1/chsrc.1" ]; then + echo "WARNING: chsrc man page not found at /usr/share/man/man1/chsrc.1" +else + echo "✓ chsrc man page exists" +fi + +# Test 3: Test basic functionality +echo "Testing basic chsrc functionality..." +if /usr/bin/chsrc help >/dev/null 2>&1; then + echo "✓ command 'chsrc help' works" +else + echo "ERROR: command 'chsrc help' failed" + exit 1 +fi + +if /usr/bin/chsrc list >/dev/null 2>&1; then + echo "✓ command 'chsrc list' works" +else + echo "ERROR: command 'chsrc list' failed" + exit 1 +fi + +echo "All installation tests of DEB package 'chsrc' passed!" diff --git a/pkg/DEB/deb-test.sh b/pkg/DEB/deb-test.sh deleted file mode 100755 index bedcf8f..0000000 --- a/pkg/DEB/deb-test.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# Test script for DEB package functionality - -set -e - -echo "Testing chsrc DEB package..." - -# Test 1: Check if chsrc binary exists and is executable -if [ ! -f "/usr/bin/chsrc" ]; then - echo "ERROR: chsrc binary not found at /usr/bin/chsrc" - exit 1 -fi - -if [ ! -x "/usr/bin/chsrc" ]; then - echo "ERROR: chsrc binary is not executable" - exit 1 -fi - -echo "✓ chsrc binary exists and is executable" - -# Test 2: Check if man page exists -if [ ! -f "/usr/share/man/man1/chsrc.1" ]; then - echo "WARNING: chsrc man page not found at /usr/share/man/man1/chsrc.1" -else - echo "✓ chsrc man page exists" -fi - -# Test 3: Test basic functionality -echo "Testing basic chsrc functionality..." -if chsrc help >/dev/null 2>&1; then - echo "✓ chsrc help command works" -else - echo "ERROR: chsrc help command failed" - exit 1 -fi - -if chsrc list >/dev/null 2>&1; then - echo "✓ chsrc list command works" -else - echo "WARNING: chsrc list command failed" -fi - -echo "All DEB package tests passed!"