diff --git a/tests/minipack/unittests/fscd/test_data/fan10_input b/tests/minipack/unittests/fscd/test_data/fan10_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan10_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan11_input b/tests/minipack/unittests/fscd/test_data/fan11_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan11_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan12_input b/tests/minipack/unittests/fscd/test_data/fan12_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan12_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan13_input b/tests/minipack/unittests/fscd/test_data/fan13_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan13_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan14_input b/tests/minipack/unittests/fscd/test_data/fan14_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan14_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan15_input b/tests/minipack/unittests/fscd/test_data/fan15_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan15_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan16_input b/tests/minipack/unittests/fscd/test_data/fan16_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan16_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan1_input b/tests/minipack/unittests/fscd/test_data/fan1_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan1_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan2_input b/tests/minipack/unittests/fscd/test_data/fan2_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan2_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan3_input b/tests/minipack/unittests/fscd/test_data/fan3_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan3_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan4_input b/tests/minipack/unittests/fscd/test_data/fan4_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan4_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan5_input b/tests/minipack/unittests/fscd/test_data/fan5_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan5_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan6_input b/tests/minipack/unittests/fscd/test_data/fan6_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan6_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan7_input b/tests/minipack/unittests/fscd/test_data/fan7_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan7_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan8_input b/tests/minipack/unittests/fscd/test_data/fan8_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan8_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fan9_input b/tests/minipack/unittests/fscd/test_data/fan9_input new file mode 100644 index 000000000000..7038a21741b5 --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fan9_input @@ -0,0 +1 @@ +3300 diff --git a/tests/minipack/unittests/fscd/test_data/fsc-32-config-test2.json b/tests/minipack/unittests/fscd/test_data/fsc-32-config-test2.json new file mode 100644 index 000000000000..9f065cffb6aa --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fsc-32-config-test2.json @@ -0,0 +1,266 @@ +{ + "pwm_transition_value": 16, + "pwm_boost_value": 20, + "sample_interval_ms": 3000, + "boost": { + "fan_fail": true, + "sensor_fail": false, + "progressive": true + }, + "fan_dead_boost": { + "data": [ + [1,2], + [2,2] + ] + }, + "watchdog": true , + "min_rpm": 800, + "profiles": { + "SCM_INLET_REMOTE_TEMP": { + "read_source" : { + "util" : "/usr/local/bin/sensor-util" + }, + "read_limit": { + "valid": { + "limit": 60, + "threshold": 20, + "action": "host_shutdown" + }, + "invalid": { + "limit": -60, + "threshold": 10, + "action": "host_shutdown" + } + }, + "type": "linear", + "positive_hysteresis": 0, + "negative_hysteresis": 1, + "data": [ + [5, 8], + [20, 8], + [23, 9], + [26, 10], + [29, 11], + [31, 12], + [33, 13], + [35, 14], + [37, 15], + [39, 16] + ] + }, + "TH3_DIE_TEMP1": { + "read_source" : { + "util" : "/usr/local/bin/sensor-util" + }, + "read_limit": { + "valid": { + "limit": 110, + "threshold": 20, + "action": "host_shutdown" + }, + "invalid":{ + "limit": -60, + "threshold": 10, + "action": "host_shutdown" + } + }, + "type": "linear", + "positive_hysteresis": 0, + "negative_hysteresis": 2, + "data": [ + [5, 8], + [100, 13], + [105, 16] + ] + }, + "TH3_DIE_TEMP2": { + "read_source" : { + "util" : "/usr/local/bin/sensor-util" + }, + "read_limit": { + "valid": { + "limit": 110, + "threshold": 20, + "action": "host_shutdown" + }, + "invalid":{ + "limit": -60, + "threshold": 10, + "action": "host_shutdown" + } + }, + "type": "linear", + "positive_hysteresis": 0, + "negative_hysteresis": 2, + "data": [ + [5, 8], + [100, 13], + [105, 16] + ] + } + }, + "fans": { + "1": { + "label" : "Fan 1 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan1_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-64/64-0033/fantray1_pwm" + } + }, + "2": { + "label" : "Fan 1 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan2_input" + } + }, + "3": { + "label" : "Fan 2 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan3_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-72/72-0033/fantray1_pwm" + } + }, + "4": { + "label" : "Fan 2 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan4_input" + } + }, + "5": { + "label" : "Fan 3 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan5_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-64/64-0033/fantray2_pwm" + } + }, + "6": { + "label" : "Fan 3 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan6_input" + } + }, + "7": { + "label" : "Fan 4 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan7_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-72/72-0033/fantray2_pwm" + } + }, + "8": { + "label" : "Fan 4 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan8_input" + } + }, + "9": { + "label" : "Fan 5 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan9_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-64/64-0033/fantray3_pwm" + } + }, + "10": { + "label" : "Fan 5 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan10_input" + } + }, + "11": { + "label" : "Fan 6 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan11_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-72/72-0033/fantray3_pwm" + } + }, + "12": { + "label" : "Fan 6 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan12_input" + } + }, + "13": { + "label" : "Fan 7 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan13_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-64/64-0033/fantray4_pwm" + } + }, + "14": { + "label" : "Fan 7 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan14_input" + } + }, + "15": { + "label" : "Fan 8 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan15_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-72/72-0033/fantray4_pwm" + } + }, + "16": { + "label" : "Fan 8 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan16_input" + } + } + }, + "zones": { + "zone_1": { + "pwm_output": [1, 3, 5, 7, 9, 11, 13, 15], + "expr_file": "zone1.fsc" + } + }, + "notes": { + "FAN_PWM[4:0] table": { + "0_0000" : "0/32 or 0% duty cycle", + "0_0001" : "1/32 or 3.125% duty cycle", + "0_0010" : "2/32 or 6.25% duty cycle", + "0_0011" : "3/32 or 9.375% duty cycle", + "0_0100" : "4/32 or 12.5% duty cycle ", + "0_0101" : "5/32 or 16.625% duty cycle", + "0_0110" : "6/32 or 18.725% duty cycle", + "0_0111" : "7/32 or 21.875% duty cycle ", + "0_1000" : "8/32 or 25% duty cycle ", + "0_1001" : "9/32 or 28.125% duty cycle ", + "0_1010" : "10/32 or 31.25% duty cycle ", + "0_1011" : "11/32 or 34.375% duty cycle ", + "0_1100" : "12/32 or 37.5% duty cycle ", + "0_1101" : "13/32 or 41.625% duty cycle ", + "0_1110" : "14/32 or 43.725% duty cycle ", + "0_1111" : "15/32 or 46.875% duty cycle ", + "1_0000" : "16/32 or 50% duty cycle ", + "1_0001" : "17/32 or 53.125% duty cycle ", + "1_0010" : "18/32 or 56.25% duty cycle ", + "1_0011" : "19/32 or 59.375% duty cycle ", + "1_0100" : "20/32 or 62.5% duty cycle ", + "1_0101" : "21/32 or 66.625% duty cycle ", + "1_0110" : "22/32 or 68.725% duty cycle ", + "1_0111" : "23/32 or 71.875% duty cycle ", + "1_1000" : "24/32 or 75% duty cycle ", + "1_1001" : "25/32 or 78.125% duty cycle ", + "1_1010" : "26/32 or 81.25% duty cycle ", + "1_1011" : "27/32 or 84.375% duty cycle ", + "1_1100" : "28/32 or 87.5% duty cycle ", + "1_1101" : "29/32 or 91.625% duty cycle ", + "1_1110" : "30/32 or 93.725% duty cycle ", + "1_1111" : "32/32 or 100% duty cycle " + } + } +} diff --git a/tests/minipack/unittests/fscd/test_data/fsc-64-config-test1.json b/tests/minipack/unittests/fscd/test_data/fsc-64-config-test1.json index 272c465276de..5c48e929cd8b 100644 --- a/tests/minipack/unittests/fscd/test_data/fsc-64-config-test1.json +++ b/tests/minipack/unittests/fscd/test_data/fsc-64-config-test1.json @@ -16,7 +16,7 @@ "watchdog": true , "min_rpm": 800, "profiles": { - "linear_inlet": { + "SCM_INLET_REMOTE_TEMP": { "read_source" : { "util" : "/usr/local/bin/sensor-util" }, @@ -48,7 +48,7 @@ [39, 32] ] }, - "linear_switch1": { + "TH3_DIE_TEMP1": { "read_source" : { "util" : "/usr/local/bin/sensor-util" }, @@ -73,7 +73,7 @@ [105, 32] ] }, - "linear_switch2": { + "TH3_DIE_TEMP2": { "read_source" : { "util" : "/usr/local/bin/sensor-util" }, diff --git a/tests/minipack/unittests/fscd/test_data/fsc-64-config-test2.json b/tests/minipack/unittests/fscd/test_data/fsc-64-config-test2.json new file mode 100644 index 000000000000..240fb1f68dae --- /dev/null +++ b/tests/minipack/unittests/fscd/test_data/fsc-64-config-test2.json @@ -0,0 +1,298 @@ +{ + "pwm_transition_value": 32, + "pwm_boost_value": 40, + "sample_interval_ms": 3000, + "boost": { + "fan_fail": true, + "sensor_fail": false, + "progressive": true + }, + "fan_dead_boost": { + "data": [ + [1,4], + [2,4] + ] + }, + "watchdog": true , + "min_rpm": 800, + "profiles": { + "SCM_INLET_REMOTE_TEMP": { + "read_source" : { + "util" : "/usr/local/bin/sensor-util" + }, + "read_limit": { + "valid": { + "limit": 60, + "threshold": 20, + "action": "host_shutdown" + }, + "invalid": { + "limit": -60, + "threshold": 10, + "action": "host_shutdown" + } + }, + "type": "linear", + "positive_hysteresis": 0, + "negative_hysteresis": 1, + "data": [ + [5, 16], + [20, 16], + [23, 18], + [26, 20], + [29, 22], + [31, 24], + [33, 26], + [35, 28], + [37, 30], + [39, 32] + ] + }, + "TH3_DIE_TEMP1": { + "read_source" : { + "util" : "/usr/local/bin/sensor-util" + }, + "read_limit": { + "valid": { + "limit": 110, + "threshold": 20, + "action": "host_shutdown" + }, + "invalid":{ + "limit": -60, + "threshold": 10, + "action": "host_shutdown" + } + }, + "type": "linear", + "positive_hysteresis": 0, + "negative_hysteresis": 2, + "data": [ + [5, 16], + [100, 26], + [105, 32] + ] + }, + "TH3_DIE_TEMP2": { + "read_source" : { + "util" : "/usr/local/bin/sensor-util" + }, + "read_limit": { + "valid": { + "limit": 110, + "threshold": 20, + "action": "host_shutdown" + }, + "invalid":{ + "limit": -60, + "threshold": 10, + "action": "host_shutdown" + } + }, + "type": "linear", + "positive_hysteresis": 0, + "negative_hysteresis": 2, + "data": [ + [5, 16], + [100, 26], + [105, 32] + ] + } + }, + "fans": { + "1": { + "label" : "Fan 1 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan1_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-64/64-0033/fantray1_pwm" + } + }, + "2": { + "label" : "Fan 1 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan2_input" + } + }, + "3": { + "label" : "Fan 2 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan3_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-72/72-0033/fantray1_pwm" + } + }, + "4": { + "label" : "Fan 2 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan4_input" + } + }, + "5": { + "label" : "Fan 3 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan5_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-64/64-0033/fantray2_pwm" + } + }, + "6": { + "label" : "Fan 3 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan6_input" + } + }, + "7": { + "label" : "Fan 4 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan7_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-72/72-0033/fantray2_pwm" + } + }, + "8": { + "label" : "Fan 4 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan8_input" + } + }, + "9": { + "label" : "Fan 5 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan9_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-64/64-0033/fantray3_pwm" + } + }, + "10": { + "label" : "Fan 5 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan10_input" + } + }, + "11": { + "label" : "Fan 6 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan11_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-72/72-0033/fantray3_pwm" + } + }, + "12": { + "label" : "Fan 6 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan12_input" + } + }, + "13": { + "label" : "Fan 7 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan13_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-64/64-0033/fantray4_pwm" + } + }, + "14": { + "label" : "Fan 7 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan14_input" + } + }, + "15": { + "label" : "Fan 8 Front", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan15_input" + }, + "write_source" : { + "sysfs": "/sys/class/i2c-adapter/i2c-72/72-0033/fantray4_pwm" + } + }, + "16": { + "label" : "Fan 8 Rear", + "read_source" : { + "sysfs": "/tmp/tests/minipack/unittests/fscd/test_data/fan16_input" + } + } + }, + "zones": { + "zone_1": { + "pwm_output": [1, 3, 5, 7, 9, 11, 13, 15], + "expr_file": "zone1.fsc" + } + }, + "notes": { + "FAN_PWM[5:0] table": { + "00_0000" : "0/63 or 0% duty cycle", + "00_0001" : "1/63 or 1.549% duty cycle", + "00_0010" : "2/63 or 3.116% duty cycle", + "00_0011" : "3/63 or 4.671% duty cycle", + "00_0100" : "4/63 or 6.235% duty cycle ", + "00_0101" : "5/63 or 7.804% duty cycle", + "00_0110" : "6/63 or 9.358% duty cycle", + "00_0111" : "7/63 or 10.923% duty cycle ", + "00_1000" : "8/63 or 12.485% duty cycle ", + "00_1001" : "9/63 or 14.047% duty cycle ", + "00_1010" : "10/63 or 15.611% duty cycle ", + "00_1011" : "11/63 or 17.174% duty cycle ", + "00_1100" : "12/63 or 18.732% duty cycle ", + "00_1101" : "13/63 or 20.295% duty cycle ", + "00_1110" : "14/63 or 21.864% duty cycle ", + "00_1111" : "15/63 or 23.414% duty cycle ", + "01_0000" : "16/63 or 24.987% duty cycle ", + "01_0001" : "17/63 or 26.553% duty cycle ", + "01_0010" : "18/63 or 28.121% duty cycle ", + "01_0011" : "19/63 or 29.678% duty cycle ", + "01_0100" : "20/63 or 31.234% duty cycle ", + "01_0101" : "21/63 or 32.795% duty cycle ", + "01_0110" : "22/63 or 34.375% duty cycle ", + "01_0111" : "23/63 or 35.923% duty cycle ", + "01_1000" : "24/63 or 37.482% duty cycle ", + "01_1001" : "25/63 or 39.048% duty cycle ", + "01_1010" : "26/63 or 40.617% duty cycle ", + "01_1011" : "27/63 or 42.177% duty cycle ", + "01_1100" : "28/63 or 43.732% duty cycle ", + "01_1101" : "29/63 or 45.303% duty cycle ", + "01_1110" : "30/63 or 46.863% duty cycle ", + "01_1111" : "32/63 or 49.900% duty cycle ", + "10_0000" : "33/63 or 51.546% duty cycle", + "10_0001" : "34/63 or 53.109% duty cycle", + "10_0010" : "35/63 or 54.669% duty cycle", + "10_0011" : "36/63 or 56.234% duty cycle", + "10_0100" : "37/63 or 57.789% duty cycle ", + "10_0101" : "38/63 or 59.369% duty cycle", + "10_0110" : "39/63 or 60.932% duty cycle", + "10_0111" : "40/63 or 62.495% duty cycle ", + "10_1000" : "41/63 or 63.041% duty cycle ", + "10_1001" : "42/63 or 65.613% duty cycle ", + "10_1010" : "43/63 or 67.177% duty cycle ", + "10_1011" : "44/63 or 68.745% duty cycle ", + "10_1100" : "45/63 or 70.295% duty cycle ", + "10_1101" : "46/63 or 71.863% duty cycle ", + "10_1110" : "47/63 or 73.419% duty cycle ", + "10_1111" : "48/63 or 74.975% duty cycle ", + "11_0000" : "49/63 or 76.553% duty cycle ", + "11_0001" : "50/63 or 78.106% duty cycle ", + "11_0010" : "51/63 or 79.671% duty cycle ", + "11_0011" : "52/63 or 81.234% duty cycle ", + "11_0100" : "53/63 or 82.796% duty cycle ", + "11_0101" : "54/63 or 84.349% duty cycle ", + "11_0110" : "55/63 or 85.925% duty cycle ", + "11_0111" : "56/63 or 87.482% duty cycle ", + "11_1000" : "57/63 or 89.039% duty cycle ", + "11_1001" : "58/63 or 90.606% duty cycle ", + "11_1010" : "59/63 or 92.169% duty cycle ", + "11_1011" : "60/63 or 93.736% duty cycle ", + "11_1100" : "61/63 or 95.297% duty cycle ", + "11_1101" : "62/63 or 96.861% duty cycle ", + "11_1110" : "63/63 or 98.424% duty cycle ", + "11_1111" : "63/63 or 100% duty cycle " + } + } +} diff --git a/tests/minipack/unittests/fscd_test.py b/tests/minipack/unittests/fscd_test.py index a8d364fa4b06..f4a759927f67 100644 --- a/tests/minipack/unittests/fscd_test.py +++ b/tests/minipack/unittests/fscd_test.py @@ -14,7 +14,7 @@ class fscdTest(): - TEST_DATA_PATH = "/tmp/tests/wedge100/unittests/fscd/test_data" + TEST_DATA_PATH = "/tmp/tests/minipack/unittests/fscd/test_data" def run_shell_cmd(self, cmd=None): if not cmd: @@ -38,7 +38,8 @@ def start_fscd(self): self.run_shell_cmd("sv start fscd") def stop_fscd(self): - self.run_shell_cmd("sv stop fscd;watchdog_ctrl.sh off") + self.run_shell_cmd("sv stop fscd") + self.run_shell_cmd("/usr/local/bin/watchdog_ctrl.sh off") def start_sensord(self): self.run_shell_cmd("sv start sensord") @@ -95,7 +96,7 @@ def get_fan_pwm(self, pwm_val=None): return [False, data] return [True, None] - def run_pwm_test(self, + def run_pwm_test1(self, inlet_temp=DEFAULT_TEMP, switch1_temp=DEFAULT_TEMP, switch2_temp=DEFAULT_TEMP, @@ -126,17 +127,30 @@ def run_pwm_test(self, return False return True + def run_pwm_test2(self, name, PWM_VAL): + print("[FSCD Testing] %s testing..." % name) + rc, output = self.get_fan_pwm(pwm_val=PWM_VAL) + if rc: + print("[FSCD Testing] {} testing,expected={}% [PASSED]". + format(name, PWM_VAL)) + else: + print("[FSCD Testing] {} testing," + "expected={}% received={}" + " [FAILED]".format(name, PWM_VAL, output)) + return False + return True + def is_userver_on(self): data = self.run_shell_cmd("/usr/local/bin/wedge_power.sh status") if "on" in data: return True return False - def run_test(self): + def run_test1(self): ''' test1: - Setup: fsc-config-test1.json - reads sensors temperature from test_data - but reads RPMs and PWMs from HW. + Setup: fsc-32/64-config-test1.json - reads data like original one. + Just change the values where sensor-util reads from. 1) Series of tests to verify PWM setting based on the fsc-config 2) host action test for shutdown when a high temp event can occur 3) host action test for shutdown when read failure can occur @@ -152,98 +166,98 @@ def run_test(self): rc = True time.sleep(20) # sub-test1: pwm when all temp=5C duty_cycle=25 - if not self.run_pwm_test(inlet_temp=5, + if not self.run_pwm_test1(inlet_temp=5, switch1_temp=5, switch2_temp=5, expected_pwm=25): rc = False # sub-test2: pwm when all temp=20C duty_cycle=25 - if not self.run_pwm_test(inlet_temp=20, + if not self.run_pwm_test1(inlet_temp=20, switch1_temp=20, switch2_temp=20, expected_pwm=25): rc = False # sub-test3: pwm when all temp=23C duty_cycle=28 - if not self.run_pwm_test(inlet_temp=23, + if not self.run_pwm_test1(inlet_temp=23, switch1_temp=23, switch2_temp=23, expected_pwm=28): rc = False # sub-test4: pwm when all temp=26C duty_cycle=31 - if not self.run_pwm_test(inlet_temp=26, + if not self.run_pwm_test1(inlet_temp=26, switch1_temp=26, switch2_temp=26, expected_pwm=31): rc = False # sub-test5: pwm when all temp=29C duty_cycle=34 - if not self.run_pwm_test(inlet_temp=29, + if not self.run_pwm_test1(inlet_temp=29, switch1_temp=29, switch2_temp=29, expected_pwm=34): rc = False # sub-test6: pwm when all temp=31C duty_cycle=38 - if not self.run_pwm_test(inlet_temp=31, + if not self.run_pwm_test1(inlet_temp=31, switch1_temp=31, switch2_temp=31, expected_pwm=38): rc = False # sub-test7: pwm when all temp=33C duty_cycle=41 - if not self.run_pwm_test(inlet_temp=33, + if not self.run_pwm_test1(inlet_temp=33, switch1_temp=33, switch2_temp=33, expected_pwm=41): rc = False # sub-test8: pwm when all temp=35C duty_cycle=44 - if not self.run_pwm_test(inlet_temp=35, + if not self.run_pwm_test1(inlet_temp=35, switch1_temp=35, switch2_temp=35, expected_pwm=44): rc = False # sub-test9: pwm when all temp=37C duty_cycle=47 - if not self.run_pwm_test(inlet_temp=37, + if not self.run_pwm_test1(inlet_temp=37, switch1_temp=37, switch2_temp=37, expected_pwm=47): rc = False # sub-test10: pwm when all temp=39C duty_cycle=50 - if not self.run_pwm_test(inlet_temp=39, + if not self.run_pwm_test1(inlet_temp=39, switch1_temp=39, switch2_temp=39, expected_pwm=50): rc = False # sub-test11: pwm when switch1 temp=100C duty_cycle=41 - if not self.run_pwm_test(inlet_temp=20, + if not self.run_pwm_test1(inlet_temp=20, switch1_temp=100, switch2_temp=20, expected_pwm=41): rc = False # sub-test12: pwm when switch2 temp=100C duty_cycle=41 - if not self.run_pwm_test(inlet_temp=20, + if not self.run_pwm_test1(inlet_temp=20, switch1_temp=20, switch2_temp=100, expected_pwm=41): rc = False # sub-test13: pwm when switch1 temp=29C duty_cycle=50 - if not self.run_pwm_test(inlet_temp=20, + if not self.run_pwm_test1(inlet_temp=20, switch1_temp=105, switch2_temp=20, expected_pwm=50): rc = False # sub-test14: pwm when switch2 temp=29C duty_cycle=50 - if not self.run_pwm_test(inlet_temp=20, + if not self.run_pwm_test1(inlet_temp=20, switch1_temp=20, switch2_temp=105, expected_pwm=50): @@ -252,14 +266,14 @@ def run_test(self): # sub-test15: At this point the system should shutdown because # temperature limit reached # Wait for threshold cycle = ~20sec - if not self.run_pwm_test(inlet_temp=20, + if not self.run_pwm_test1(inlet_temp=20, switch1_temp=115, switch2_temp=20, expected_pwm=50): rc = False print("[FSCD Testing] System should shutdown because temperature " - " limit reached. Verifying...") + "limit reached. Verifying...") time.sleep(70) if not self.is_userver_on(): print("[FSCD Testing] Host action test: Expected userver to " @@ -273,7 +287,7 @@ def run_test(self): # failure. Wait for threshold cycle = ~20sec. # Firstly recover to good state print("[FSCD Testing] Recovering system for next test...") - self.run_pwm_test(inlet_temp=39, + self.run_pwm_test1(inlet_temp=39, switch1_temp=39, switch2_temp=39, expected_pwm=50) @@ -298,6 +312,57 @@ def run_test(self): return rc + def run_test2(self): + ''' + test2: + fan dead test + Setup: fsc-32/64-config-test2.json - reads sensors temperature from + sensor-util but reads RPMs and PWMs from test-data. + 1) fan_dead_boost test for one or more fans are broken + ''' + fcm_b = self.run_shell_cmd( + "head -n1 /sys/class/i2c-adapter/i2c-72/72-0033/cpld_ver") + fcm_t = self.run_shell_cmd( + "head -n1 /sys/class/i2c-adapter/i2c-64/64-0033/cpld_ver") + if "0x0" in fcm_b or "0x0" in fcm_t: + self.setup_for_test(config="fsc-32-config-test2.json") + else: + self.setup_for_test(config="fsc-64-config-test2.json") + rc = True + time.sleep(30) + + # sub-test1: setup temp environment to make sure fan speed raises + #identical value every time. + print("[FSCD Testing] Setup temp environment to set pwm as 25%") + if not self.run_pwm_test1(inlet_temp=20, + switch1_temp=20, + switch2_temp=20, + expected_pwm=25): + rc = False + + # sub-test1: One fan dead testing + PWM_VAL = 38 + path = "/tmp/tests/minipack/unittests/fscd/test_data/fan1_input" + self.run_shell_cmd("echo 0 > {}".format(path)) + path = "/tmp/tests/minipack/unittests/fscd/test_data/fan2_input" + self.run_shell_cmd("echo 0 > {}".format(path)) + time.sleep(30) + if not self.run_pwm_test2("One fan dead", PWM_VAL): + rc = False + + # sub-test2: Two fans dead testing + PWM_VAL = 63 + path = "/tmp/tests/minipack/unittests/fscd/test_data/fan3_input" + self.run_shell_cmd("echo 0 > {}".format(path)) + path = "/tmp/tests/minipack/unittests/fscd/test_data/fan4_input" + self.run_shell_cmd("echo 0 > {}".format(path)) + time.sleep(30) + + if not self.run_pwm_test2("Two fans dead", PWM_VAL): + rc = False + + return rc + if __name__ == '__main__': ''' @@ -307,8 +372,11 @@ def run_test(self): try: test.stop_sensord() time.sleep(20) - result = test.run_test() - if result: + result1 = test.run_test1() + test.tear_down_tests() + test.stop_sensord() + result2 = test.run_test2() + if result2: print("FSCD Testing [PASSED]") test.tear_down_tests() exit(0)