Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit e942c16

Browse files
Merge branch 'main' into Release-9.1.0
2 parents 5e21b6c + f9f26b9 commit e942c16

File tree

6 files changed

+25
-15
lines changed

6 files changed

+25
-15
lines changed

src/ApiService/ApiService/OneFuzzTypes/Model.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,9 @@ public record Job(
978978
StoredUserInfo? UserInfo,
979979
string? Error = null,
980980
DateTimeOffset? EndTime = null
981-
) : StatefulEntityBase<JobState>(State) { }
981+
) : StatefulEntityBase<JobState>(State) {
982+
983+
}
982984

983985
// This is like UserInfo but lacks the UPN:
984986
public record StoredUserInfo(Guid? ApplicationId, Guid? ObjectId);

src/ApiService/ApiService/OneFuzzTypes/Responses.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public record TaskSearchResult(
5252
List<NodeAssignment> Nodes,
5353
[property: JsonPropertyName("Timestamp")] // must retain capital T for backcompat
5454
DateTimeOffset? Timestamp
55-
) : BaseResponse();
55+
) : BaseResponse() {
56+
public DateTimeOffset? StartTime => EndTime is DateTimeOffset endTime ? endTime.Subtract(TimeSpan.FromHours(Config.Task.Duration)) : null;
57+
}
5658

5759
public record BoolResult(
5860
bool Result
@@ -113,6 +115,7 @@ public static JobResponse ForJob(Job j, IEnumerable<IJobTaskInfo>? taskInfo)
113115
UserInfo: j.UserInfo,
114116
Timestamp: j.Timestamp
115117
);
118+
public DateTimeOffset? StartTime => EndTime is DateTimeOffset endTime ? endTime.Subtract(TimeSpan.FromHours(Config.Duration)) : null;
116119
}
117120

118121
public record PoolGetResult(

src/agent/coverage/src/allowlist.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@ impl AllowList {
7474
self.allow.is_match(path) && !self.deny.is_match(path)
7575
}
7676

77-
/// Build a new `Allowlist` that adds the allow and deny rules of `other` to `self`.
78-
pub fn extend(&self, other: &Self) -> Self {
77+
/// Modifies the AllowList by adding the allow and deny rules of `other` to `self`.
78+
pub fn extend_in_place(&mut self, other: &Self) {
7979
let allow = add_regexsets(&self.allow, &other.allow);
8080
let deny = add_regexsets(&self.deny, &other.deny);
8181

82-
AllowList::new(allow, deny)
82+
self.allow = allow;
83+
self.deny = deny;
8384
}
8485
}
8586

src/agent/coverage/src/allowlist/tests.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fn test_allow_glob_extension() -> Result<()> {
121121
fn test_allowlist_extend() -> Result<()> {
122122
let baseline_text = "! bad/*
123123
other/*";
124-
let baseline = AllowList::parse(baseline_text)?;
124+
let mut baseline = AllowList::parse(baseline_text)?;
125125

126126
assert!(!baseline.is_allowed("bad/a"));
127127
assert!(!baseline.is_allowed("bad/b"));
@@ -144,20 +144,20 @@ bad/*
144144
assert!(!provided.is_allowed("other/a"));
145145
assert!(!provided.is_allowed("other/b"));
146146

147-
let extended = baseline.extend(&provided);
147+
baseline.extend_in_place(&provided);
148148

149149
// Deny rules from `baseline` should not be overridden by `provided`, but
150150
// allow rules should be.
151151
//
152152
// A provided allowlist can deny patterns that are baseline-allowed, but
153153
// cannot allow patterns that are baseline-denied.
154-
assert!(!extended.is_allowed("bad/a"));
155-
assert!(!extended.is_allowed("bad/b"));
156-
assert!(extended.is_allowed("good/a"));
157-
assert!(extended.is_allowed("good/b"));
158-
assert!(extended.is_allowed("good/bad/c"));
159-
assert!(!extended.is_allowed("other/a"));
160-
assert!(!extended.is_allowed("other/b"));
154+
assert!(!baseline.is_allowed("bad/a"));
155+
assert!(!baseline.is_allowed("bad/b"));
156+
assert!(baseline.is_allowed("good/a"));
157+
assert!(baseline.is_allowed("good/b"));
158+
assert!(baseline.is_allowed("good/bad/c"));
159+
assert!(!baseline.is_allowed("other/a"));
160+
assert!(!baseline.is_allowed("other/b"));
161161

162162
Ok(())
163163
}

src/agent/onefuzz-task/src/tasks/coverage/generic.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ impl CoverageTask {
199199
// process startup functions. Setting software breakpoints in these functions breaks
200200
// interceptor init, and causes test case execution to diverge.
201201
let interceptor_denylist = AllowList::parse(WINDOWS_INTERCEPTOR_DENYLIST)?;
202-
allowlist.source_files.extend(&interceptor_denylist);
202+
allowlist
203+
.source_files
204+
.extend_in_place(&interceptor_denylist);
203205
}
204206

205207
Ok(allowlist)

src/pytypes/onefuzztypes/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ class Task(BaseModel):
747747
events: Optional[List[TaskEventSummary]]
748748
nodes: Optional[List[NodeAssignment]]
749749
user_info: Optional[UserInfo]
750+
start_time: Optional[datetime] = None
750751

751752

752753
class Job(BaseModel):
@@ -758,6 +759,7 @@ class Job(BaseModel):
758759
end_time: Optional[datetime] = None
759760
task_info: Optional[List[Union[Task, JobTaskInfo]]]
760761
user_info: Optional[UserInfo]
762+
start_time: Optional[datetime] = None
761763

762764

763765
class NetworkConfig(BaseModel):

0 commit comments

Comments
 (0)