fix(process): stabilize native capture and ownership prerequisites
This commit is contained in:
@@ -548,7 +548,6 @@ it.skipIf(!onDarwin)(
|
||||
clearedAppleVectorTokenFailsClosed: true,
|
||||
callerPfzBeforeTokenRead: true,
|
||||
emptyLaterArgumentRead: true,
|
||||
emptyEnvironmentFailsClosed: true,
|
||||
emptyArgv0Read: true,
|
||||
emptyEnvironmentRecordsBeforeTokenFailClosed: true,
|
||||
duplicateTokenFailsClosed: true,
|
||||
@@ -677,7 +676,7 @@ it.skipIf(!onDarwin)(
|
||||
);
|
||||
|
||||
it.skipIf(!onDarwin)(
|
||||
"reads owned tokens with empty later arguments across executable path padding",
|
||||
"reads owned tokens across executable padding and distinguishes a real empty environment",
|
||||
async () => {
|
||||
const root = await mkdtemp(join(tmpdir(), "rea-process-token-padding-"));
|
||||
const host = createSystemProcessOwnershipHost("darwin");
|
||||
@@ -699,6 +698,7 @@ it.skipIf(!onDarwin)(
|
||||
),
|
||||
);
|
||||
}
|
||||
children.push(await startNodeChild({}));
|
||||
const processes = await host.listProcesses();
|
||||
const entries = children.map(({ pid }) => {
|
||||
const entry = processes.find((process) => process.pid === pid);
|
||||
@@ -710,6 +710,7 @@ it.skipIf(!onDarwin)(
|
||||
expect(children.map(({ pid }) => observations?.get(pid))).toEqual([
|
||||
{ state: "readable", runId: "synthetic-padding-0" },
|
||||
{ state: "readable", runId: "synthetic-padding-1" },
|
||||
{ state: "readable" },
|
||||
]);
|
||||
} finally {
|
||||
for (const { child } of children) await stopNodeChild(child);
|
||||
|
||||
@@ -4,6 +4,7 @@ let app = NSApplication.shared
|
||||
app.setActivationPolicy(.accessory)
|
||||
let window = NSWindow(contentRect: NSRect(x: 120, y: 120, width: 360, height: 180), styleMask: [.titled, .closable], backing: .buffered, defer: false)
|
||||
window.title = "REA source-owned UI verification"
|
||||
window.animationBehavior = .none
|
||||
final class FixtureController: NSObject {
|
||||
@objc func increment(_ sender: NSButton) { sender.title = "REA fixture incremented" }
|
||||
}
|
||||
@@ -13,7 +14,8 @@ button.title = "Increment REA fixture"
|
||||
button.target = controller
|
||||
button.action = #selector(FixtureController.increment(_:))
|
||||
window.contentView?.addSubview(button)
|
||||
window.orderFront(nil)
|
||||
window.makeKeyAndOrderFront(nil)
|
||||
app.activate(ignoringOtherApps: true)
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
let record = "{\"pid\":\(ProcessInfo.processInfo.processIdentifier),\"window_id\":\(window.windowNumber)}\n"
|
||||
FileHandle.standardOutput.write(Data(record.utf8))
|
||||
|
||||
@@ -132,13 +132,6 @@ struct ProcessRunTokenParserProbe {
|
||||
} catch RunTokenReadError.duplicateToken {
|
||||
duplicateTokenFailsClosed = true
|
||||
}
|
||||
let emptyEnvironmentFailsClosed: Bool
|
||||
do {
|
||||
_ = try token(in: fixture(arguments: ["/fixture/executable"], environment: []))
|
||||
emptyEnvironmentFailsClosed = false
|
||||
} catch RunTokenReadError.environmentUnavailable {
|
||||
emptyEnvironmentFailsClosed = true
|
||||
}
|
||||
let missingAppleBoundaryFailsClosed: Bool
|
||||
do {
|
||||
_ = try token(in: fixture(
|
||||
@@ -158,7 +151,6 @@ struct ProcessRunTokenParserProbe {
|
||||
"alternatePaddingRead": alternatePadding == "alternate-padding-token",
|
||||
"truncatedArgvFailsClosed": truncatedArgvFailsClosed,
|
||||
"duplicateTokenFailsClosed": duplicateTokenFailsClosed,
|
||||
"emptyEnvironmentFailsClosed": emptyEnvironmentFailsClosed,
|
||||
"missingAppleBoundaryFailsClosed": missingAppleBoundaryFailsClosed,
|
||||
"emptyArgv0Read": emptyArgv0Read == "empty-argv0-token",
|
||||
"finalAssignmentArgumentRead": finalAssignmentArgumentRead == "final-assignment-token",
|
||||
|
||||
Reference in New Issue
Block a user