Test Cases#
This page lists verification test cases for the score::time module, organized by functional requirement.
FR-1 Vehicle Time Synchronization#
TC-FR1-001 — gPTP Synchronization Establishment Verification#
- Type:
System Function
- Method:
Log + Packet Capture
- Priority:
High
Preconditions
Test device is powered on and started
A gPTP Time Master is available in the network
Wireshark/tcpdump is deployed on test PC or mirror port
Device logs are accessible
Test Steps
Start Wireshark on test PC, filter: eth.type == 0x88F7
Start score::time service on target device
Wait 60s
Check captured gPTP packets in Wireshark
Execute log view command on device
Record AccuracyQualifier status in logs
Expected Result
Packet Capture
✓ Pdelay_Req packets sent by this device are visible
✓ Pdelay_Resp, Sync, Follow_Up packets received by this device are visible
✓ No Sync packets sent by this device (device is Slave)
Log Verification
✓ Log shows AccuracyQualifier changed to kSynchronized
✓ No persistent ERROR-level logs
TC-FR1-002 — gPTP Master Disconnection State Degradation#
- Type:
System Function
- Method:
Log Verification
- Priority:
High
Preconditions
FR-1-001 completed, device is in kSynchronized state
Device logs accessible
Network connectivity of gPTP Master can be controlled (unplug cable or shut down Master service)
Test Steps
Confirm AccuracyQualifier == kSynchronized in log, record timestamp
Disconnect gPTP Master network
Wait 60s (exceeds syncLossTimeout configuration)
Check latest AccuracyQualifier status in device log
Reconnect Master network
Wait 60s
Check AccuracyQualifier status in log again
Expected Result
Disconnection Phase
✓ Log shows AccuracyQualifier degraded from kSynchronized to kUnstable or kNoTime
✓ Sync loss warning/error present in log
Recovery Phase
✓ Log shows kSynchronized state restored
✓ No service crash during entire recovery process
TC-FR1-003 — Startup Behavior Without gPTP Master#
- Type:
System Function
- Method:
Log Verification
- Priority:
High
Preconditions
No gPTP Time Master in network (or Master is shut down)
Device logs accessible
Test Steps
Confirm no gPTP Master in network
Restart score::time service on target device
Wait 60s
Check AccuracyQualifier status in log
Verify service process is still running
Expected Result
Log Verification
✓ AccuracyQualifier remains kNoTime
✓ Log contains clear sync failure or waiting-for-Master records
Service Stability
✓ Service process not crashed, running normally
✓ No segfault or core dump
TC-FR1-004 — Device Does Not Send gPTP Sync Packets (Slave Role)#
- Type:
System Function
- Method:
Packet Capture
- Priority:
Medium
Preconditions
gPTP Time Master available in network
Wireshark deployed
Test Steps
Start Wireshark, filter: eth.type == 0x88F7
Start score::time service, wait 120s
Filter: source MAC is this device, gPTP messageType == Sync (0x0)
Count number of such packets
Expected Result
Packet Capture
✓ 0 Sync packets actively sent by this device
✓ Pdelay_Req packets sent by this device visible (messageType == 0x2)
✓ Sync and Follow_Up packets received by this device visible
FR-2 Vehicle Time Sync Precision#
TC-FR2-001 — AVB Node Synchronization Accuracy Verification (≤1 μs)#
- Type:
Performance
- Method:
Clock Comparison
- Priority:
Medium
Preconditions
Device is AVB node, gPTP sync completed
Reference clock source (GPS or high-precision Master) available
Accuracy measurement tool ready
Test Steps
Wait for AccuracyQualifier == kSynchronized then wait 5 more minutes to stabilize
Continuously sample for 10 minutes, record each offset
Calculate: max offset, average offset, standard deviation
Expected Result
✓ All sample offsets within 10 minutes have absolute value ≤ 1 μs
✓ No abnormal jumps (single offset change ≤ 500 ns)
✗ Fail if any sample offset > 1 μs
TC-FR2-002 — Non-AVB Node Synchronization Accuracy Verification (≤500 μs)#
- Type:
Performance
- Method:
Clock Comparison
- Priority:
Medium
Preconditions
Device is non-AVB node, gPTP sync completed
Reference clock available
Test Steps
Wait for sync to stabilize (AccuracyQualifier == kSynchronized, then wait 2 more minutes)
Continuously sample for 5 minutes, record each offset
Calculate max offset
Expected Result
✓ All sample offsets have absolute value ≤ 500 μs
✓ Most samples ≤ 200 μs (target range 200–500 μs)
✗ Fail if offset > 500 μs
FR-3 Vehicle Time Base API#
TC-FR3-001 — Vehicle Time Now() Can Be Read Normally#
- Type:
System Function
- Method:
Test Tool
- Priority:
High
Preconditions
gPTP sync completed (AccuracyQualifier == kSynchronized)
Test client tool deployed
Test Steps
Call IVehicleTime::Now(), record return value T1
Wait 1s
Call Now() again, record T2
Calculate T2 - T1
Execute 10 consecutive times
Expected Result
✓ Each call succeeds without error code
✓ T2 > T1 (monotonically increasing)
✓ T2 - T1 in range [950ms, 1050ms] (error ≤5%)
✓ No crash or exception in all 10 calls
TC-FR3-002 — Vehicle Time Has Nanosecond Resolution#
- Type:
System Function
- Method:
Test Tool
- Priority:
High
Preconditions
gPTP sync completed
Test client tool available
Test Steps
Rapidly call Now() 10 consecutive times
Record complete time value returned each time (including nanosecond portion)
Check difference between adjacent return values
Expected Result
✓ Return value contains non-zero nanosecond field
✓ Difference between adjacent calls > 0 (time is advancing)
✓ Difference value consistent with actual call interval, precision at microsecond level
TC-FR3-003 — Vehicle Time Aligned with gPTP Master Clock#
- Type:
System Function
- Method:
Test Tool + Clock Comparison
- Priority:
High
Preconditions
gPTP sync completed
Current gPTP Master time is known
Test tool available
Test Steps
Read current time T_master from gPTP Master device
Immediately read IVehicleTime::Now() from local device to get T_local
Calculate
abs(T_local - T_master)Repeat 5 times
Expected Result
✓
abs(T_local - T_master)is within acceptable range (accounting for read operation latency)✓ 5 results are stable, no random jumps
FR-4 Vehicle Time Base Accuracy Qualifier#
TC-FR4-001 — AccuracyQualifier State: kNoTime#
- Type:
System Function
- Method:
Test Tool + Log Verification
- Priority:
High
Preconditions
No gPTP Master in network
score::time service just started (first run, never synced)
Test tool available
Test Steps
Start score::time service in environment without Master
Wait 10s
Query GetAccuracyQualifier() return value
Simultaneously check state record in log
Expected Result
✓ GetAccuracyQualifier() returns kNoTime
✓ Corresponding kNoTime state record present in log
✓ Now() can still be called in this state (no crash)
TC-FR4-002 — AccuracyQualifier State: kSynchronized#
- Type:
System Function
- Method:
Test Tool + Log Verification
- Priority:
High
Preconditions
Stable gPTP Master available in network
Test tool available
Test Steps
Start score::time service, connect to gPTP Master
After 60s query GetAccuracyQualifier()
View log to confirm state transition (kNoTime → kUnstable → kSynchronized)
Expected Result
✓ GetAccuracyQualifier() returns kSynchronized after 60s
✓ State transition process visible in log
✓ State transition order is reasonable
TC-FR4-003 — AccuracyQualifier State: kTimeJumpDetected#
- Type:
System Function
- Method:
Test Tool + Log Verification
- Priority:
Medium
Preconditions
Device is in kSynchronized state
Large clock jump can be injected (> threshold)
Test Steps
Confirm current state is kSynchronized
Inject large time jump (local clock offset from Master > jump detection threshold, e.g., > 1ms)
Immediately query GetAccuracyQualifier()
Query again after 30s
Expected Result
✓ GetAccuracyQualifier() returns kTimeJumpDetected after jump injection
✓ Clock jump detection record present in log
✓ System recovers from kTimeJumpDetected after 30s
TC-FR4-004 — AccuracyQualifier State: kUnstable#
- Type:
System Function
- Method:
Test Tool + Log Verification
- Priority:
Medium
Preconditions
gPTP Master signal quality can be degraded (e.g., via network emulator to introduce jitter)
Test tool available
Test Steps
Device is in kSynchronized state
Introduce persistent high jitter or intermittent packet loss to gPTP network
Wait 20s, query GetAccuracyQualifier()
Restore network quality, wait 60s, query again
Expected Result
✓ GetAccuracyQualifier() returns kUnstable during degradation period
✓ Log contains accuracy instability records
✓ State returns to kSynchronized after network recovery
FR-5 Vehicle Time Base Time Point Qualifier#
TC-FR5-001 — TimePointQualifier ASIL Safety Level Query#
- Type:
System Function
- Method:
Test Tool
- Priority:
Medium
Preconditions
score::time service running
ASIL-B safety clock source configured
Test tool available
Test Steps
Query GetTimePointQualifier() when safety clock source is normal
Simulate safety clock source failure (or degrade to QM source)
Query GetTimePointQualifier() again
Expected Result
✓ Returns kASIL_B when safety clock source is normal
✓ Degrades to kQM after safety clock source failure
✓ State changes are logged
FR-6 Vehicle Time Control Flow#
TC-FR6-001 — Now() Call Performance (Low Latency)#
- Type:
Performance
- Method:
Test Tool
- Priority:
Medium
Preconditions
score::time service running
Test tool supports high-frequency calls and timing statistics
Test Steps
Continuously call IVehicleTime::Now() 1000 times
Record each call latency
Calculate: average latency, P99 latency, max latency
Expected Result
✓ Average call latency < 1 μs
✓ P99 latency < 5 μs
✓ No single call exceeds 100 μs (no kernel syscall blocking)
Note: If latency is significantly high (>10 μs average), shared memory mechanism may not be working
FR-7 Vehicle Time Synchronization Logging#
TC-FR7-001 — Sync State Change Log Recording#
- Type:
Manual Acceptance
- Method:
Log Verification
- Priority:
High
Preconditions
Device logs accessible
Network environment controllable (can disconnect/restore gPTP Master)
Test Steps
Clear or mark current log position
Disconnect gPTP Master network, wait 30s
Restore Master network, wait 60s
View log, search keywords: AccuracyQualifier, sync, kSynchronized, kNoTime, kUnstable
Expected Result
✓ Log contains AccuracyQualifier state change records (with timestamp)
✓ Degradation log present when Master disconnects
✓ Re-sync log present when Master restores
✓ Log timestamp format is correct
TC-FR7-002 — Sync Statistics Log (Offset/Frequency)#
- Type:
Manual Acceptance
- Method:
Log Verification
- Priority:
Medium
Preconditions
Device in sync state, logs accessible
Test Steps
Run for 10 minutes, view periodic sync statistics in log
Search keywords: offset, rate, correction, pDelay
Expected Result
✓ Log contains periodically recorded clock offset values
✓ Rate correction (rateCorrection) or path delay (pDelay) logs present
✓ Values within reasonable range, no abnormal values
TC-FR7-003 — Logging Does Not Block Sync Main Process#
- Type:
Manual Acceptance
- Method:
Log Verification + Clock Comparison
- Priority:
Low
Preconditions
Device in sync state
Test Steps
Monitor both log output and sync accuracy (offset) simultaneously
Measure sync accuracy during high-frequency log output (debug level)
Disable verbose logging, measure accuracy again
Compare accuracy difference between the two modes
Expected Result
✓ Sync accuracy not significantly degraded with verbose logging enabled (offset increase < 50 μs)
✓ Log thread does not affect real-time performance of sync main thread
FR-8 score::time External Synchronization#
TC-FR8-001 — NTP Sync Source Configuration and Connection#
- Type:
System Function
- Method:
Log Verification
- Priority:
Medium
Preconditions
NTP Server accessible in network
score::time NTP function configuration enabled
Logs accessible
Test Steps
Configure NTP Server address
Restart score::time service
Wait 120s
Check NTP sync status in log (search: NTP, AbsoluteTime, synchronized)
Expected Result
✓ Log shows NTP sync success record
✓ No persistent NTP connection failure errors in log
✓ AbsoluteTime-related log has state update records
TC-FR8-002 — Fallback Behavior When NTP Server Unreachable#
- Type:
System Function
- Method:
Log Verification
- Priority:
Medium
Preconditions
NTP function enabled
NTP Server address configured as unreachable
Test Steps
Configure NTP Server to unreachable address (e.g., 192.0.2.1)
Restart service, wait 120s
Check AbsoluteTime AccuracyQualifier status in log
Expected Result
✓ Log contains NTP connection failure record
✓ IAbsoluteTime AccuracyQualifier does not enter synchronized state
✓ Service does not crash, continues providing other functions
FR-9 Absolute Time Base API#
TC-FR9-001 — IAbsoluteTime::Now() Returns UTC Time#
- Type:
System Function
- Method:
Test Tool
- Priority:
Medium
Preconditions
NTP sync completed
Test tool available
Accurate UTC time known (confirmed via phone or other device)
Test Steps
Call IAbsoluteTime::Now()
Record returned UTC time
Compare with UTC time displayed on reference device
Expected Result
✓ Return value is valid UTC timestamp (UNIX Epoch format, not 0)
✓ Offset from reference UTC time < 1s (NTP accuracy range)
✓ Time value monotonically increasing across multiple calls
FR-10 Absolute Time Base Accuracy Qualifier#
TC-FR10-001 — Absolute Time AccuracyQualifier State Verification#
- Type:
System Function
- Method:
Test Tool + Log Verification
- Priority:
Medium
Preconditions
Test tool available
NTP sync state controllable
Test Steps
Query IAbsoluteTime GetAccuracyQualifier() when NTP not synced, record state
Query again after NTP sync completed
View log records of absolute time accuracy
Expected Result
✓ Returns appropriate low accuracy level when NTP not synced
✓ Accuracy level improves after NTP sync
✓ Accuracy level changes are logged
FR-11 Absolute Time Base Security Qualifier#
TC-FR11-001 — Absolute Time SecurityQualifier State Verification#
- Type:
System Function
- Method:
Test Tool + Log Verification
- Priority:
Medium
Preconditions
Test tool available
Different security level clock sources can be simulated
Test Steps
Query IAbsoluteTime GetSecurityQualifier() when using unauthenticated NTP source
Query again when using authenticated/secure NTP source
View security level records in log
Expected Result
Security levels (low to high): NoTimeAvailable, NotTrustworthy, Trustworthy, VeryTrustworthy
✓ Returns corresponding security level for different security sources
✓ State changes are logged
FR-12 Absolute Time Synchronization Status Log#
TC-FR12-001 — Absolute Time Sync Log Recording#
- Type:
Manual Acceptance
- Method:
Log Verification
- Priority:
Low
Preconditions
NTP sync function enabled
Logs accessible
Test Steps
Perform NTP sync operation (restart service to re-sync)
View log, search: AbsoluteTime, NTP, UTC
Check log content completeness
Expected Result
✓ Log contains NTP sync start/completion records
✓ Absolute time accuracy level change records present
✓ Security level status records present
✓ Log format includes timestamp
FR-13 High Precision Clock API#
TC-FR13-001 — HighPrecisionClock::Now() Returns High Precision Time#
- Type:
System Function
- Method:
Test Tool
- Priority:
Medium
Preconditions
Test tool available
System clock (CLOCK_REALTIME) synchronized
Test Steps
Call HighPrecisionClockImpl::Now()
Record returned time value (precise to nanoseconds)
Compare with system clock_gettime(CLOCK_REALTIME) return value
Call 10 consecutive times, confirm monotonicity
Expected Result
✓ Return value differs from system CLOCK_REALTIME time by < 1ms
✓ Return value has nanosecond precision
✓ 10 consecutive calls are monotonically increasing
✓ No call failures
TC-FR13-002 — Time Relationship Between HighPrecisionClock and VehicleTime#
- Type:
System Function
- Method:
Test Tool
- Priority:
Low
Preconditions
gPTP sync completed
Test tool can read both interfaces simultaneously
Test Steps
Simultaneously call HighPrecisionClockImpl::Now() and IVehicleTime::Now()
Calculate difference between them
Repeat 5 times
Expected Result
✓ Difference is stable (fixed offset, not randomly varying)
✓ Variance of difference < 100 μs (indicating both synced to same clock domain)
FR-14 Monotonic Clock API#
TC-FR14-001 — MonotonicClock::Now() Monotonicity Verification#
- Type:
System Function
- Method:
Test Tool
- Priority:
High
Preconditions
Test tool available
Test Steps
Call MonotonicClockImpl::Now() 20 times at 100ms intervals
Record each return value
Check if sequence is strictly increasing
Expected Result
✓ All 20 return values strictly increasing (T[i+1] > T[i])
✓ Adjacent differences approximately 100ms (error < 5%)
✓ No wraparound or jumps
TC-FR14-002 — MonotonicClock Maintains Monotonicity During System Clock Adjustment#
- Type:
System Function
- Method:
Test Tool
- Priority:
High
Preconditions
Test tool available
Permission to adjust system clock (date -s or chronyc makestep)
Test Steps
Start continuous sampling of MonotonicClock::Now() at 50ms intervals
Execute system time jump during sampling (e.g., advance clock by 5s)
Continue sampling for 30s
Check monotonicity of complete sample sequence
Expected Result
✓ Entire sample sequence (including during clock jump) is strictly monotonically increasing
✓ MonotonicClock is not affected by system clock adjustment
TC-FR14-003 — MonotonicClock Corresponds to CLOCK_MONOTONIC#
- Type:
System Function
- Method:
Test Tool
- Priority:
Medium
Preconditions
Test tool available
Can read system CLOCK_MONOTONIC at the same time
Test Steps
Simultaneously call MonotonicClockImpl::Now() and system clock_gettime(CLOCK_MONOTONIC)
Compare two return values
Repeat 5 times
Expected Result
✓ Two values approximately equal (difference < 1ms)
✓ Both increase at the same rate
FR-15 score::time Mocking APIs#
TC-FR15-001 — ManualVehicleTime Can Set Time Manually#
- Type:
System Function
- Method:
Test Tool
- Priority:
Medium
Preconditions
score::time service started in Mock mode (ManualVehicleTime implementation)
Test tool available
Test Steps
Set ManualVehicleTime to specified time T_set (e.g., 2024-01-01 12:00:00)
Call IVehicleTime::Now(), record T_read
Wait 1s, call Now() again, record T_read2
Expected Result
✓ T_read == T_set (allow < 1ms error)
✓ T_read2 == T_set (time does not advance automatically unless manually advanced)
✓ Does not depend on real gPTP network
TC-FR15-002 — ManualVehicleTime Time Can Be Manually Advanced#
- Type:
System Function
- Method:
Test Tool
- Priority:
Medium
Preconditions
Mock mode started, ManualVehicleTime initial time set
Test tool available
Test Steps
Record current ManualVehicleTime value T0
Advance time by +500ms via test tool
Call Now(), record T1
Advance by +1s more
Call Now(), record T2
Expected Result
✓ T1 - T0 == 500ms (error < 1ms)
✓ T2 - T1 == 1s (error < 1ms)
✓ Time advancement is controllable, not affected by system clock
TC-FR15-003 — ManualVehicleTime AccuracyQualifier Can Be Set Manually#
- Type:
System Function
- Method:
Test Tool
- Priority:
Medium
Preconditions
Mock mode started
Test Steps
Set AccuracyQualifier to kNoTime, confirm with GetAccuracyQualifier()
Set to kSynchronized, confirm again
Set to kUnstable, confirm again
Expected Result
✓ All 3 settings take effect, GetAccuracyQualifier() return value matches set value
✓ State switching causes no crash
TC-FR15-004 — ManualAbsoluteTime Can Set UTC Time#
- Type:
System Function
- Method:
Test Tool
- Priority:
Low
Preconditions
Mock mode started (ManualAbsoluteTime implementation)
Test tool available
Test Steps
Set ManualAbsoluteTime to specified UTC time
Call IAbsoluteTime::Now(), verify return value
Set SecurityQualifier to Trustworthy, verify GetSecurityQualifier() return value
Expected Result
✓ IAbsoluteTime::Now() returns the set UTC time
✓ GetSecurityQualifier() returns Trustworthy
✓ Function decoupled from real NTP sync behavior
TC-FR15-005 — ManualMonotonicClock Isolation in Unit Tests#
- Type:
Manual Acceptance
- Method:
Test Tool
- Priority:
Low
Preconditions
Unit test framework configured to use Mock implementation
No real hardware environment required
Test Steps
Run unit tests using ManualMonotonicClock
Manually set and advance time in tests, verify time-related logic
Confirm tests do not depend on system time
Expected Result
✓ Unit tests pass without gPTP/NTP network environment
✓ Test execution time not affected by system clock
✓ Mock object behavior consistent with interface specification