Skip to content

Commit

Permalink
Make all rtcwake cmd can select the RTC_DEVICE_FILE from config file …
Browse files Browse the repository at this point in the history
…(New) (#1395)

* Make rtcwake can select the rtc_device in config file

* Add default RTC_DEVICE_FILE in checkbox-snap config_vars

* Add default RTC_DEVICE_FILE in checkbox-ce-oem/checkbox-snap config_vars

* Add default RTC_DEVICE_FILE in checkbox-ce-oem/README.md
  • Loading branch information
seankingyang authored Aug 8, 2024
1 parent 924c571 commit fd17448
Show file tree
Hide file tree
Showing 21 changed files with 32 additions and 16 deletions.
1 change: 1 addition & 0 deletions checkbox-snap/common_series_uc/config_vars
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ WWAN_SETUPTIME=30
TPM2TOOLS_TCTI_NAME=device
TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
RTC_DEVICE_FILE=/dev/rtc0
1 change: 1 addition & 0 deletions checkbox-snap/series_classic16/config_vars
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ STRESS_S3_WAIT_DELAY=120
STRESS_BOOT_WAIT_DELAY=120
WIFI_AP_SETUPTIME=30
WWAN_SETUPTIME=30
RTC_DEVICE_FILE=/dev/rtc0
1 change: 1 addition & 0 deletions checkbox-snap/series_classic18/config_vars
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ WWAN_SETUPTIME=30
TPM2TOOLS_TCTI_NAME=device
TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
RTC_DEVICE_FILE=/dev/rtc0
1 change: 1 addition & 0 deletions checkbox-snap/series_classic20/config_vars
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ WWAN_SETUPTIME=30
TPM2TOOLS_TCTI_NAME=device
TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
RTC_DEVICE_FILE=/dev/rtc0
1 change: 1 addition & 0 deletions checkbox-snap/series_classic22/config_vars
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ WWAN_SETUPTIME=30
TPM2TOOLS_TCTI_NAME=device
TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
RTC_DEVICE_FILE=/dev/rtc0
1 change: 1 addition & 0 deletions checkbox-snap/series_classic24/config_vars
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ WWAN_SETUPTIME=30
TPM2TOOLS_TCTI_NAME=device
TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
RTC_DEVICE_FILE=/dev/rtc0
1 change: 1 addition & 0 deletions checkbox-snap/series_uc24/config_vars
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ WWAN_SETUPTIME=30
TPM2TOOLS_TCTI_NAME=device
TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
RTC_DEVICE_FILE=/dev/rtc0
1 change: 1 addition & 0 deletions contrib/checkbox-ce-oem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ WWAN_APN=internet
WWAN_CONTROL_IF=ttyACM3
WWAN_NET_IF=ppp0
WWAN_SETUPTIME=30
RTC_DEVICE_FILE=/dev/rtc0
# modify checkbox configuration
$ sudo checkbox-ce-oem.configure WIFI_AP_SETUPTIME=50
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
WATCHDOG_TYPE=wdat_wdt
WATCHDOG_IDENTITY=wdat_wdt
RTC_DEVICE_FILE=/dev/rtc0
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
WATCHDOG_TYPE=wdat_wdt
WATCHDOG_IDENTITY=wdat_wdt
RTC_DEVICE_FILE=/dev/rtc0
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
WATCHDOG_TYPE=wdat_wdt
WATCHDOG_IDENTITY=wdat_wdt
RTC_DEVICE_FILE=/dev/rtc0
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
WATCHDOG_TYPE=wdat_wdt
WATCHDOG_IDENTITY=wdat_wdt
RTC_DEVICE_FILE=/dev/rtc0
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
WATCHDOG_TYPE=wdat_wdt
WATCHDOG_IDENTITY=wdat_wdt
RTC_DEVICE_FILE=/dev/rtc0
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ TPM2TOOLS_DEVICE_FILE=/dev/tpm0
MODEL_GRADE=signed
WATCHDOG_TYPE=wdat_wdt
WATCHDOG_IDENTITY=wdat_wdt
RTC_DEVICE_FILE=/dev/rtc0
2 changes: 1 addition & 1 deletion providers/base/bin/suspend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ if [ "$architecture" = "x86_64" ] || [ "$architecture" = "i386" ]; then
checkbox-support-fwts_test -f none -s s3 --s3-device-check --s3-device-check-delay="${STRESS_S3_WAIT_DELAY:-45}" --s3-sleep-delay="${STRESS_S3_SLEEP_DELAY:-30}"
rm /tmp/fwts_results.log
else
rtcwake -v -m mem -s "${STRESS_S3_SLEEP_DELAY:-30}"
rtcwake -v -d "${RTC_DEVICE_FILE:-rtc0}" -m mem -s "${STRESS_S3_SLEEP_DELAY:-30}"
fi

6 changes: 3 additions & 3 deletions providers/base/units/power-management/jobs.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,14 @@ requires:
rtc.state == 'supported'
rtc.wakealarm == 'supported'
command:
rtcwake --mode no -s "${COLD_REBOOT_DELAY:-120}"
rtcwake -v -d "${RTC_DEVICE_FILE:-rtc0}" --mode no -s "${COLD_REBOOT_DELAY:-120}"
sleep 5
rtcwake -m show
rtcwake -v -d "${RTC_DEVICE_FILE:-rtc0}" -m show
sleep 5
dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.PowerOff" boolean:true
user: root
flags: preserve-locale noreturn autorestart
environ: COLD_REBOOT_DELAY
environ: COLD_REBOOT_DELAY RTC_DEVICE_FILE
estimated_duration: 300

id: power-management/post-cold-reboot
Expand Down
5 changes: 3 additions & 2 deletions providers/base/units/rtc/jobs.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ _steps:
1. Start the test to power off the system (wakeup scheduled in 30s).
_verification:
RTC can wake up the system successfully.
environ: RTC_DEVICE_FILE
command:
rtcwake -v -m disable
rtcwake -v -m off -s 30
rtcwake -v -d "${RTC_DEVICE_FILE:-rtc0}" -m disable
rtcwake -v -d "${RTC_DEVICE_FILE:-rtc0}" -m off -s 30
plugin: user-interact
user: root
category_id: rtc_category
Expand Down
9 changes: 5 additions & 4 deletions providers/base/units/stress/boot.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ _summary: Perform cold reboot 1
_description: Enter sleep mode after a configurable delay.
unit: job
plugin: shell
environ: STRESS_BOOT_WAKEUP_DELAY
command: rtcwake --mode off -s "${STRESS_BOOT_WAKEUP_DELAY:-120}"
environ: STRESS_BOOT_WAKEUP_DELAY RTC_DEVICE_FILE
command:
rtcwake -v -d "${RTC_DEVICE_FILE:-rtc0}" --mode off -s "${STRESS_BOOT_WAKEUP_DELAY:-120}"
user: root
flags: preserve-locale noreturn autorestart
estimated_duration: 180.0
Expand All @@ -70,10 +71,10 @@ unit: template
template-resource: reboot-run-generator
template-unit: job
plugin: shell
environ: STRESS_BOOT_WAKEUP_DELAY STRESS_BOOT_WAIT_DELAY
environ: STRESS_BOOT_WAKEUP_DELAY STRESS_BOOT_WAIT_DELAY RTC_DEVICE_FILE
command:
sleep "${{STRESS_BOOT_WAIT_DELAY:-120}}"
rtcwake --mode off -s "${{STRESS_BOOT_WAKEUP_DELAY:-120}}"
rtcwake -v -d "${{RTC_DEVICE_FILE:-rtc0}}" --mode off -s "${{STRESS_BOOT_WAKEUP_DELAY:-120}}"
user: root
flags: preserve-locale noreturn autorestart
estimated_duration: 180.0
Expand Down
4 changes: 2 additions & 2 deletions providers/base/units/stress/s3s4.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ requires:
sleep.mem == 'supported'
rtc.state == 'supported'
estimated_duration: 2400.0
environ: PLAINBOX_SESSION_SHARE STRESS_S3_SLEEP_DELAY STRESS_S3_WAIT_DELAY LD_LIBRARY_PATH
environ: PLAINBOX_SESSION_SHARE STRESS_S3_SLEEP_DELAY STRESS_S3_WAIT_DELAY LD_LIBRARY_PATH RTC_DEVICE_FILE
user: root
command:
{%- if fwts == "supported" %}
Expand All @@ -68,7 +68,7 @@ command:
for i in {1..{{ s3_iterations }}};
do
echo "Iteration $i"
rtcwake -v -m mem -s "${STRESS_S3_SLEEP_DELAY:-30}"
rtcwake -v -d "${RTC_DEVICE_FILE:-rtc0}" -m mem -s "${STRESS_S3_SLEEP_DELAY:-30}"
done
{% endif -%}
_purpose:
Expand Down
4 changes: 2 additions & 2 deletions providers/base/units/stress/suspend_cycles_reboot.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ requires:
sleep.mem == 'supported'
rtc.state == 'supported'
estimated_duration: 75.0
environ: PLAINBOX_SESSION_SHARE STRESS_S3_SLEEP_DELAY STRESS_S3_WAIT_DELAY LD_LIBRARY_PATH
environ: PLAINBOX_SESSION_SHARE STRESS_S3_SLEEP_DELAY STRESS_S3_WAIT_DELAY LD_LIBRARY_PATH RTC_DEVICE_FILE
user: root
command:
suspend.sh 2>&1 | tee -a "$PLAINBOX_SESSION_SHARE"/suspend_cycles_with_reboot_total.log
Expand All @@ -100,7 +100,7 @@ requires:
sleep.mem == 'supported'
rtc.state == 'supported'
estimated_duration: 75.0
environ: PLAINBOX_SESSION_SHARE STRESS_S3_SLEEP_DELAY STRESS_S3_WAIT_DELAY LD_LIBRARY_PATH
environ: PLAINBOX_SESSION_SHARE STRESS_S3_SLEEP_DELAY STRESS_S3_WAIT_DELAY LD_LIBRARY_PATH RTC_DEVICE_FILE
after: stress-tests/suspend_cycles_reboot{{suspend_reboot_previous}}
user: root
command:
Expand Down
4 changes: 2 additions & 2 deletions providers/genio/units/thermal/jobs.pxu
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ flags: preserve-locale noreturn autorestart also-after-suspend
user: root
plugin: shell
estimated_duration: 60
environ: PLAINBOX_SESSION_SHARE
environ: PLAINBOX_SESSION_SHARE RTC_DEVICE_FILE
command:
# Clean up
if [ -f "$PLAINBOX_SESSION_SHARE/thermal-is-malfunction" ]; then
rm "$PLAINBOX_SESSION_SHARE/thermal-is-malfunction"
fi
# Feed the super high temperature to the emul_temp of thermal_zone0
# to make thermal shuts system down and rtcwake will wake system up.
rtcwake -v -m no -s 60
rtcwake -v -d "${RTC_DEVICE_FILE:-rtc0}" -m no -s 60
echo 999999 > /sys/class/thermal/thermal_zone0/emul_temp
# If thermal's protection mechanism doesn't work, reboot the system
# to prevent Checkbox stucks here due to noreturn flag
Expand Down

0 comments on commit fd17448

Please sign in to comment.