forked from mlichvar/linuxptp-testsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
31-leapsecond
executable file
·100 lines (87 loc) · 2.26 KB
/
31-leapsecond
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
. test.common
test_start "ptp4l and phc2sys with leap second"
export CLKNETSIM_START_DATE=$(TZ=UTC date -d 'Dec 31 2030 0:00:00' +'%s')
limit=$[60 * 3600]
leap_start=$[24 * 3600]
utc_offset=37
time_max_limit=5e-3
time_rms_limit=1e-3
freq_max_limit=5e-6
freq_rms_limit=2e-6
base_conf="logAnnounceInterval 10
logSyncInterval 10
logMinDelayReqInterval 10"
pmc_node=3
pmc_uds="1:1"
pmc_start=$[12 * 3600]
phc2sys_node=4
phc2sys_uds="2:1"
phc2sys_conf="-a -r -R 0.01 -E linreg"
phc2sys_phc_base=2
phc2sys_phc_swap=1
for leap in "+1" "-1"; do
for master_ts in "software" "hardware"; do
for slave_ts in "software" "hardware"; do
master_conf="$base_conf
time_stamping $master_ts"
slave_conf="$base_conf
time_stamping $slave_ts
clock_servo linreg"
case "$master_ts+$slave_ts" in
software+software)
nodes=3
min_sync_time=$[$leap_start - 1]
max_sync_time=$[$leap_start]
step1=$leap
step2=$[-$leap]
ptp_timescale=0
refclock_offset=0.0
;;
software+hardware)
nodes=4
min_sync_time=$[$leap_start + 1000]
# This should be much smaller, but
# there is no reliable way to limit
# the number of points of the servo
max_sync_time=$[$leap_start + 30000]
step1=$leap
step2=$[-$leap]
ptp_timescale=0
refclock_offset=0.0
;;
hardware+software)
nodes=3
min_sync_time=$[$leap_start - 1]
max_sync_time=$[$leap_start]
step1=$[$utc_offset + $leap]
step2=0
ptp_timescale=1
refclock_offset=0.0
;;
hardware+hardware)
nodes=4
min_sync_time=11000
max_sync_time=$[$leap_start]
step1=0
step2=0
ptp_timescale=1
refclock_offset=$[-($utc_offset + $leap)]
;;
esac
case $leap in
+1)
leap_conf="leap61 1 leap59 0"
;;
-1)
leap_conf="leap61 0 leap59 1"
;;
esac
master_step="(+ (* $step1 (equal 0.1 (sum 1.0) 1)) (* $step2 (equal 0.1 (sum 1.0) 86400)))"
pmc_conf="SET GRANDMASTER_SETTINGS_NP clockClass 6 clockAccuracy 0xfe offsetScaledLogVariance 0xffff currentUtcOffset $utc_offset $leap_conf currentUtcOffsetValid 1 ptpTimescale $ptp_timescale timeTraceable 1 frequencyTraceable 1 timeSource 0xa1"
run_ptp4l || test_fail
check_sync || test_fail
done
done
done
test_pass