Rename to deb-installation-test.sh

This commit is contained in:
Aoran Zeng 2025-06-15 23:38:04 +08:00
parent 5a1c1f5470
commit aea231bbc0
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
5 changed files with 61 additions and 53 deletions

View File

@ -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

View File

@ -78,7 +78,7 @@ sudo apt-get install -f # 修复依赖问题
```bash
# 运行测试
./deb-test.sh
bash ./deb-installation-test.sh
# 查看文档安装情况
man chsrc

View File

@ -27,7 +27,7 @@
- `debian/` - DEB 包构建配置目录
- `BUILD.md` - 如何手动构建
- `deb.makefile` - DEB 包构建 Makefile
- `deb-test.sh` - DEB 包 **已正确安装** 测试脚本
- `deb-installation-test.sh` - DEB 包 **已正确安装** 测试脚本
<br>

View File

@ -0,0 +1,55 @@
#!/bin/bash
# --------------------------------------------------------------
# SPDX-License-Identifier: GPL-3.0-or-later
# --------------------------------------------------------------
# Test File : deb-installation-test.sh
# File Authors : sanchuanhehe <wyihe5520@gmail.com>
# Contributors : Aoran Zeng <ccmywish@qq.com>
# |
# 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!"

View File

@ -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!"