<?xml version="1.0" encoding="ISO-8859-1"?>
<testdefinition version="0.1">
  <!-- Test suite, sensorfw-tests for automated testing of sensord -->
  <suite name="Sensorfw-tests" domain="System Software">
    <!-- At least one set per suite, name and description mandatory -->
    <set name="Sensord-automated-tests" description="Unit test cases for sensord" feature="Sensor Framework" requirement="88917">
      <case name="Sensord_Filters" level="Component" type="Functional" description="Unit test cases for sensor filters" timeout="15" subfeature="Sensor Framework">
        <step expected_result="0">/usr/bin/sensorfilters-test</step>
      </case>
      <case name="Sensord_Dataflow" level="Component" type="Functional" description="Sensord dataflow test" timeout="15" subfeature="Sensor Framework">
        <step expected_result="0">/usr/bin/sensordataflow-test</step>
      </case>
      <case name="Sensord_Adaptors" level="Component" type="Functional" description="Unit test cases for sensor adaptors" timeout="15" subfeature="Sensor Framework">
        <step expected_result="0">/usr/bin/sensoradaptors-test</step>
      </case>
      <case name="Sensord_Chains" level="Component" type="Functional" description="Unit test cases for sensor chains" timeout="15" subfeature="Sensor Framework">
        <step>stop sensord</step>
	<step expected_result="0">/usr/bin/sensorchains-test</step>
        <step>start sensord</step>
        <step>sleep 2</step>
      </case>
      <case name="Sensor_Client_API" level="Component" type="Functional" description="Client API tests for sensord" timeout="90" subfeature="Sensor Framework">
        <step expected_result="0">/usr/bin/sensorapi-test</step>
      </case>
      <case name="Sensor_MetaData" level="Component" type="Functional" description="Sensor metadata tests for sensord" timeout="15" subfeature="Sensor Framework">
        <step expected_result="0">/usr/bin/sensormetadata-test</step>
      </case>
      <case name="Dead_Client" type="Functional" level="Component" description="Unit test for properly detecting dead clients." timeout="60" subfeature="Sensor Framework">
        <step expected_result="0">/usr/share/sensorfw-tests/sensord-deadclienttest.py</step>
      </case>

      <!-- Environments optional - tells where the tests are run -->
      <environments>
        <scratchbox>false</scratchbox>
        <hardware>true</hardware>
      </environments>
    </set>

    <set name="Sensord-memory-tests" description="Memory leak tests for sensord" feature="Sensor Framework" requirement="SensorFw Testing and automation">
      <case name="Sensord_Memory_OpenClose" level="Component" type="Benchmark" description="Memory leak check for session open/close" timeout="200" subfeature="Sensor Framework">
        <step>/usr/bin/sensorbenchmark-test testSessionLeaks</step>
      </case>
      <case name="Sensord_Memory_OpenKill" level="Component" type="Benchmark" description="Memory leak check for session open/kill" timeout="200" subfeature="Sensor Framework">
        <step>/usr/bin/sensorbenchmark-test testLostSessionLeaks</step>
      </case>

      <!-- Environments optional - tells where the tests are run -->
      <environments>
        <scratchbox>false</scratchbox>
        <hardware>true</hardware>
      </environments>
    </set>

    <set name="Sensord-pm-tests" description="Sensord power management tests" feature="Sensor Framework" requirement="SensorFw Testing and automation">
      <pre_steps>
        <step expected_result="0">/usr/bin/sensordiverter.sh start</step>
        <step>sleep 5</step>
      </pre_steps>

      <case name="Sensord_Power_Management" type="Functional" level="Component" description="Sensord power management handling test" timeout="100" subfeature="Sensor Framework">
        <step expected_result="0">/usr/bin/sensorpowermanagement-test</step>
      </case>

      <case name="Sensord_Standby_Override" type="Functional" level="Component" description="Sensord standby override test" timeout="100" subfeature="Sensor Framework">
        <step expected_result="0">/usr/bin/sensorstandbyoverride-test</step>
      </case>
 
      <environments>
        <scratchbox>false</scratchbox>
        <hardware>true</hardware>
      </environments>

      <post_steps>
        <step expected_result="0">/usr/bin/sensordiverter.sh stop</step>
      </post_steps>
    </set>


    <set name="Sensord-benchmark-tests" description="Benchmark test cases for sensord" feature="Sensor Framework" requirement="SensorFw Testing and automation">

      <pre_steps>
        <!-- Stop sensord, kill to make sure -->
        <step>stop sensord</step>
        <step>killall sensord</step>
        <step>rm -f /tmp/sensorTestSampleRate</step>
        <step>mv /usr/lib/sensord/libalsadaptor.so /usr/lib/sensord/libalsadaptor.so.orig</step>
        <step>ln -s /usr/lib/sensord/testing/libalsadaptor.so /usr/lib/sensord/libalsadaptor.so</step>
      </pre_steps>

      <case name="Sensord_Benchmark_50hz" level="Component" type="Benchmark" description="Sensord Benchmark @ 50hz" timeout="45" subfeature="Sensor Framework">
        <step>echo 20 > /tmp/sensorTestSampleRate</step>
        <step>start sensord</step>
        <step>sleep 2</step>
        <step>/usr/bin/sensorbenchmark-test testThroughput</step>
      </case>
      <case name="Sensord_Benchmark_200hz" level="Component" type="Benchmark" description="Sensord Benchmark @ 200hz" timeout="45" subfeature="Sensor Framework">
        <step>stop sensord</step>
        <step>echo 5 > /tmp/sensorTestSampleRate</step>
        <step>start sensord</step>
        <step>sleep 2</step>
        <step>/usr/bin/sensorbenchmark-test testThroughput</step>
      </case>
      <case name="Sensord_Benchmark_500hz" level="Component" type="Benchmark" description="Sensord Benchmark @ 500hz" timeout="45" subfeature="Sensor Framework">
        <step>stop sensord</step>
        <step>echo 2 > /tmp/sensorTestSampleRate</step>
        <step>start sensord</step>
        <step>sleep 2</step>
        <step>/usr/bin/sensorbenchmark-test testThroughput</step>
      </case>

      <post_steps>
        <!-- Clean up and restore normal behavior-->
        <step>stop sensord</step>
        <step>rm -f /tmp/sensorTestSampleRate</step>
        <step>rm -f /usr/lib/sensord/libalsadaptor.so</step>
        <step>mv /usr/lib/sensord/libalsadaptor.so.orig /usr/lib/sensord/libalsadaptor.so</step>
        <step>start sensord</step>
      </post_steps>

      <!-- Environments optional - tells where the tests are run -->
      <environments>
        <scratchbox>false</scratchbox>
        <hardware>true</hardware>
      </environments>
    </set>

    <set name="Sensord-external-tests" description="External issue tests for sensord" feature="Sensor Framework" requirement="SensorFw Testing and automation">
      <case name="Sensord_External" level="Component" type="Functional" description="Check external required API, values etc." timeout="15" subfeature="Sensor Framework" insignificant="true">
        <step>/usr/bin/sensorexternal-test</step>
      </case>

      <!-- Environments optional - tells where the tests are run -->
      <environments>
        <scratchbox>false</scratchbox>
        <hardware>true</hardware>
      </environments>
    </set>

   </suite>
 </testdefinition>
