test: Update 4 files
Some checks failed
Build-Test-Publish / build (linux/amd64) (push) Failing after 8s
Build-Test-Publish / build (linux/arm64) (push) Failing after 10s
Build-Test-Publish / test-install-from-scratch (linux/amd64) (push) Has been skipped
Build-Test-Publish / test-install-from-scratch (linux/arm64) (push) Has been skipped

This commit is contained in:
Your Name 2025-06-25 19:31:23 +12:00
parent 007c1cfdf8
commit e30111f812
4 changed files with 36 additions and 10 deletions

4
.gitignore vendored
View File

@ -48,6 +48,10 @@ CTestTestfile.cmake
*.iws
*.ipr
# Test data
dehydrate_test_data/
test_temp/
# macOS
.DS_Store
.AppleDouble

View File

@ -42,15 +42,11 @@ docker run --rm \
exit 1
fi
# Quick architecture check - the binary should at least start
if ! timeout 5 ./dehydrate_test 2>/dev/null; then
# If it fails to run, check if it's an architecture mismatch
if file dehydrate_test | grep -q 'cannot execute'; then
echo 'ERROR: Binary architecture mismatch'
echo 'Host arch:' && uname -m
echo 'Binary info:' && file dehydrate_test
exit 1
fi
# Quick architecture check - just verify the binary format
if ! file dehydrate_test | grep -q 'executable'; then
echo 'ERROR: Generated file is not an executable'
file dehydrate_test
exit 1
fi
"
@ -62,5 +58,13 @@ if [ ! -f "./dehydrate_test" ]; then
exit 1
fi
# Fix ownership of the binary (created by Docker as root)
if [ "$(stat -c %u ./dehydrate_test)" != "$(id -u)" ]; then
# Use Docker to change ownership to current user
docker run --rm -v "$PROJECT_DIR":/workdir -w /workdir/test \
gitea.jde.nz/public/dropshell-build-base:latest \
chown "$(id -u):$(id -g)" dehydrate_test
fi
# Run the test
./dehydrate_test

Binary file not shown.

View File

@ -137,7 +137,25 @@ int main() {
// Clean up any existing test data
if (fs::exists(test_root)) {
fs::remove_all(test_root);
try {
fs::remove_all(test_root);
} catch (const fs::filesystem_error& e) {
// If removal fails due to permissions, try to fix permissions first
std::cerr << "Warning: Failed to remove test directory, attempting to fix permissions: " << e.what() << std::endl;
try {
// Try to make files writable
for (auto& entry : fs::recursive_directory_iterator(test_root)) {
if (entry.is_regular_file()) {
fs::permissions(entry.path(), fs::perms::owner_write, fs::perm_options::add);
}
}
fs::remove_all(test_root);
} catch (const fs::filesystem_error& e2) {
std::cerr << "Error: Could not clean up test directory: " << e2.what() << std::endl;
std::cerr << "Please manually remove: " << test_root << std::endl;
// Continue anyway - the test might still work
}
}
}
// Create directories