diff options
-rw-r--r-- | bin/light_sensor_test | 46 | ||||
-rw-r--r-- | units/monitor/test-plan.pxu | 4 | ||||
-rw-r--r-- | units/power-management/jobs.pxu | 20 |
3 files changed, 70 insertions, 0 deletions
diff --git a/bin/light_sensor_test b/bin/light_sensor_test new file mode 100644 index 00000000..f4133968 --- /dev/null +++ b/bin/light_sensor_test @@ -0,0 +1,46 @@ +#!/bin/bash + +#Check if light sensor driver available, this section will be retired after checkbox resource jobs implement the light sensor in Device check +#Bug for reference https://bugs.launchpad.net/checkbox-support/+bug/1864960 +als_sensors=$(udevadm info --export-db|grep hid_sensor_als) + +#Check hid_sensor_als driver is loaded and available first. +if [ -z "$als_sensors" ] +then + echo "Light sensor driver not found" + exit 1 +else + echo "Light sensor driver is available" + echo "$als_sensors" +fi + +echo -e "\e[91mStart testing Ambient Light Sensor......\e[0m" +sleep 2 +echo -e "\e[92mwaiting for sensor to be covered......\e[0m" +sleep 3 + +#Output and print light sensor events 5 sec to light_sensor_test.log +timeout 5 monitor-sensor | tee $PLAINBOX_SESSION_SHARE/light_sensor_test.log & + + +#Print backlight value for 5 sec on the screen +for i in {1..10} +do + echo "Current Backlight Percentage is:" $(gdbus call --session --dest org.gnome.SettingsDaemon.Power --object-path /org/gnome/SettingsDaemon/Power --method org.freedesktop.DBus.Properties.Get org.gnome.SettingsDaemon.Power.Screen Brightness)| tr -d '()<>,' + sleep 0.5 +done + +# Fail when the user didn't wave their hand and no events have been collected. +if [[ $(cat $PLAINBOX_SESSION_SHARE/light_sensor_test.log | grep "Light changed" | wc -l) -lt 5 ]]; then +echo -e "\e[91mFAIL: Not enough data to be collect, Please rerun the test case and wave your hand around Light Sensor.\e[0m" +exit 1 +fi + + +#Print 5 values of the Light sensor value form log file +for i in {1..5} +do + echo "Ambient light sensor value " $i: `grep 'Light' $PLAINBOX_SESSION_SHARE/light_sensor_test.log | awk '{print $3}' | sed -n "$i"p` +done +exit 0 + diff --git a/units/monitor/test-plan.pxu b/units/monitor/test-plan.pxu index aa99f3f6..fd4c5070 100644 --- a/units/monitor/test-plan.pxu +++ b/units/monitor/test-plan.pxu @@ -25,6 +25,7 @@ _description: Monitor tests (integrated GPU) (Manual) include: monitor/1_powersaving_.* certification-status=blocker + power-management/light_sensor monitor/1_dim_brightness_.* certification-status=blocker monitor/1_displayport_.* certification-status=blocker audio/1_playback_displayport_.* certification-status=blocker @@ -51,6 +52,7 @@ _description: Monitor tests (after manual suspend, integrated GPU) (Manual) include: after-suspend-manual-monitor/1_powersaving_.* certification-status=blocker + after-suspend-manual-power-management/light_sensor after-suspend-manual-monitor/1_dim_brightness_.* certification-status=blocker after-suspend-manual-monitor/1_displayport_.* certification-status=blocker after-suspend-manual-audio/1_playback_displayport_.* certification-status=blocker @@ -99,6 +101,7 @@ _description: Monitor tests (discrete GPU) (Manual) include: monitor/2_powersaving_.* certification-status=blocker + power-management/light_sensor monitor/2_dim_brightness_.* certification-status=blocker monitor/2_displayport_.* certification-status=blocker audio/2_playback_displayport_.* certification-status=blocker @@ -134,6 +137,7 @@ _description: Monitor tests (after manual suspend, discrete GPU) (Manual) include: after-suspend-manual-monitor/2_powersaving_.* certification-status=blocker + after-suspend-manual-power-management/light_sensor after-suspend-manual-monitor/2_dim_brightness_.* certification-status=blocker after-suspend-manual-monitor/2_displayport_.* certification-status=blocker after-suspend-manual-audio/2_playback_displayport_.* certification-status=blocker diff --git a/units/power-management/jobs.pxu b/units/power-management/jobs.pxu index 904c2f0e..36e31c2a 100644 --- a/units/power-management/jobs.pxu +++ b/units/power-management/jobs.pxu @@ -318,3 +318,23 @@ requires: cpuinfo.platform in ('i386', 'x86_64', 'ppc64el', 'pSeries') _description: Check to see if CONFIG_NO_HZ is set in the kernel (this is just a simple regression check) command: zgrep 'CONFIG_NO_HZ=y' /snap/{kernel}/current/config-`uname -r` >/dev/null 2>&1 || ( echo "WARNING: Tickless Idle is NOT set" >&2 && exit 1 ) + +plugin: user-interact-verify +category_id: com.canonical.plainbox::power-management +id: power-management/light_sensor +estimated_duration: 10.0 +requires: dmi.product in ['Notebook','Laptop','Portable'] and executable.name == 'monitor-sensor' +flags: also-after-suspend-manual +command: light_sensor_test +_description: +_purpose: + This test will check your Ambient Light Sensor work, if you don't have it, please skip this test. +_steps: + 1. Make sure "Automatic brightness" is ON in Power settings. + 2. Locate Ambient Light Sensor, should be around the Camera. + 3. Cover your hand on the Ambient Light Sensor. + 4. When the backlight dimmed, press Enter to start testing. + 5. Wait until the message "Has ambient light sensor" is printed on the screen and wave your hand slowly during testing. +_verification: + Did the Ambient Light Sensor values change when you shaking your hands over the sensor? + Did the Screen backlight also changed? |