feat: prepare PCL-ISE 0.1.2 update test release
Release PCL-ISE / release (push) Canceled after 0s

This commit is contained in:
Coldsmile_7 committed 2026-10-27 23:57:25 +08:00
1 parent 5d549ff66a
commit e831d0dfe0
28 files changed
+1026 -286

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
using System;
using System.IO;
// Faults affect only the named target in an isolated functional test directory.
public sealed class TestLauncherUpdateFileOperations : LauncherUpdateFileOperations {
public string TargetPath;
public int CopyFailuresRemaining;
public bool LeavePartialFile;
public bool CorruptInstalledFile;
public bool FailBackup;
public bool FailRestore;
public bool FailCleanup;
public override void CopyFile(string source, string target, bool overwrite) {
bool installsTarget = string.Equals(target, TargetPath, StringComparison.OrdinalIgnoreCase)
&& source.EndsWith(".new", StringComparison.OrdinalIgnoreCase);
if (FailBackup && string.Equals(target, TargetPath + ".bak", StringComparison.OrdinalIgnoreCase))
throw new IOException("Test: backup could not be written");
if (FailRestore && string.Equals(source, TargetPath + ".bak", StringComparison.OrdinalIgnoreCase))
throw new IOException("Test: restore could not be written");
if (installsTarget && CopyFailuresRemaining > 0) {
CopyFailuresRemaining--;
if (LeavePartialFile) File.WriteAllText(target, "incomplete new program");
throw new IOException("Test: new program copy interrupted");
}
base.CopyFile(source, target, overwrite);
if (installsTarget && CorruptInstalledFile) File.WriteAllText(target, "incomplete new program");
}
public override void DeleteFile(string target) {
if (FailCleanup && target.EndsWith(".new", StringComparison.OrdinalIgnoreCase))
throw new IOException("Test: staged file temporarily busy");
base.DeleteFile(target);
}
}