Skip to content

Commit

Permalink
chore: some fixes while reading the variant reports
Browse files Browse the repository at this point in the history
  • Loading branch information
xxthunder committed Jan 12, 2024
1 parent f7bc87d commit fb3c803
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 50 deletions.
27 changes: 12 additions & 15 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@

html_theme = "sphinx_rtd_theme"

# Hide hyper link which leeds to the source of page displayed
# Show hyper link which leeds to the source of page displayed
html_show_sourcelink = True

html_theme_options = {
"canonical_url": "",
"analytics_id": "", # Provided by Google in your dashboard
"analytics_id": "", # Provided by Google in your dashboard
"display_version": True,
"prev_next_buttons_location": "bottom",
"style_external_links": True,
Expand All @@ -66,18 +66,16 @@

html_logo = "doc/_figures/SPLED_logo.png"

# EXTENSIONS AND THEIR CONFIGS ##############################################
extensions = ["sphinx_rtd_size"]
# extensions and their configuration #########################################
extensions = []

extensions.append("sphinx_rtd_size")
sphinx_rtd_size_width = "90%"

# mermaid config - @see https://pypi.org/project/sphinxcontrib-mermaid/ #####
extensions.append("sphinxcontrib.mermaid")

# sphinx_needs ###############################################################
extensions.append("sphinx_needs")

# test_reports ###############################################################
extensions.append("sphinxcontrib.test_reports")
tr_report_template = "doc/test_report_template.txt"

Expand Down Expand Up @@ -144,10 +142,8 @@ def tr_link(app, need, needs, first_option_name, second_option_name, *args, **kw
),
]


# Define own options
needs_extra_options = ["integrity", "assignee", "version"]

needs_extra_options = ["integrity"]

# Define own link types
needs_extra_links = [
Expand All @@ -172,19 +168,20 @@ def tr_link(app, need, needs, first_option_name, second_option_name, *args, **kw
"config": {},
}

# Check if the SPHINX_BUILD_CONFIGURATION_FILE environment variable exists
# and if so, load the JSON file and set the 'html_context' variable
# pass build configuration to jinja
if "SPHINX_BUILD_CONFIGURATION_FILE" in os.environ:
with open(os.environ["SPHINX_BUILD_CONFIGURATION_FILE"], "r") as file:
html_context["build_config"] = json.load(file)
include_patterns.extend(html_context["build_config"].get("include_patterns", []))
include_patterns.extend(
html_context["build_config"].get("include_patterns", [])
)

# Check if the SPHINX_BUILD_CONFIGURATION_FILE environment variable exists
# and if so, load the JSON file and set the 'html_context' variable
# pass feature configuration to jinja
if "AUTOCONF_JSON_FILE" in os.environ:
with open(os.environ["AUTOCONF_JSON_FILE"], "r") as file:
html_context["config"] = json.load(file)["features"]

# we almost forgot the variant :o)
if "VARIANT" in os.environ:
html_context["build_config"]["variant"] = os.environ["VARIANT"]

Expand Down
4 changes: 4 additions & 0 deletions doc/ai_example/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ Steps to add two additional colors to the Sleep Light for Customer B by using Gi
* Close it.
* Build the product and show that the LED is blue for the Sleep Light for Customer B.
* Open KConfig of light controller and add two additional colors to the list of colors by marking the whole file, hit Ctrl+I and ask:

::

"Please add two additional colors red and purple to the list of colors."

* Open guiconfig of variant CustB/Sleep again and configure purple as color.
* Open test_light_controller.cc and adapt the tests to support purple as configured color by marking the color config section and asking:

::

"We have 4 possible configuration values now for the selected code: blue, green, red and purple. Could you adapt this code part to reflect that?"

* Run the tests and see that they fail.
* Open light_controller.c and adapt the code to support purple as configured color by marking the function turnLightOn() and asking:

::

"We have 4 possible configuration values now for the selected code: blue, green, red and purple. Could you adapt this code part to reflect that?"

* Run the tests and see that they pass. Actually they might fail due to different definition of the colors in the test and the code.
* Adapt the test to use the same definition as the code by asking:

::

"In the productive code we used half the brightness value for red. I would like to use this color definition here, too."
Expand Down
26 changes: 0 additions & 26 deletions doc/variants/index.rst

This file was deleted.

2 changes: 1 addition & 1 deletion index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Variant Report
doc/customer_requirements/index
doc/software_requirements/index
doc/software_architecture/index
doc/variants/index
doc/ai_example/index
doc/components/index
{% if build_config.target == 'reports' %}
{{ build_config.reports_output_dir }}/coverage
Expand Down
10 changes: 5 additions & 5 deletions src/light_controller/src/light_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include "autoconf.h"

/**
* * @rst
* @rst
* .. impl:: Light state
* :id: SWIMPL_LC-001
* :implements: SWDD_LC-002
* :implements: SWDD_LC-001
* @endrst
*
* @enum LightState
Expand All @@ -32,7 +32,7 @@ const RGBColor OFF_COLOR = { .red = 0, .green = 0, .blue = 0 };
static unsigned int getBrightnessValue() {
#if CONFIG_BRIGHTNESS_ADJUSTMENT
/**
* * @rst
* @rst
* .. impl:: Variable brightness
* :id: SWIMPL_LC-005
* :implements: SWDD_LC-005
Expand All @@ -45,7 +45,7 @@ static unsigned int getBrightnessValue() {
}

/**
* * @rst
* @rst
* .. impl:: Turn light off
* :id: SWIMPL_LC-002
* :implements: SWDD_LC-003
Expand All @@ -59,7 +59,7 @@ static void turnLightOff(void) {
}

/**
* * @rst
* @rst
* .. impl:: Turn light on
* :id: SWIMPL_LC-003
* :implements: SWDD_LC-003
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @file
* @file
*/

#include <gtest/gtest.h>
Expand Down Expand Up @@ -28,7 +28,7 @@ TEST(power_signal_processing, test_power_stays_off)
EXPECT_CALL(mymock, RteGetPowerState()).Times(0);
EXPECT_CALL(mymock, RteSetPowerState(_)).Times(0);
EXPECT_CALL(mymock, RteGetPowerKeyPressed()).Times(1).WillOnce(Return(FALSE));

powerSignalProcessing();
}

Expand Down Expand Up @@ -57,7 +57,6 @@ TEST(power_signal_processing, test_power_toggles)
EXPECT_CALL(mymock, RteSetPowerState(POWER_STATE_OFF));
powerSignalProcessing();


// Press Power key once more to toggle power state back to on
EXPECT_CALL(mymock, RteGetPowerState()).WillOnce(Return(POWER_STATE_OFF));
EXPECT_CALL(mymock, RteGetPowerKeyPressed()).WillOnce(Return(TRUE));
Expand Down

0 comments on commit fb3c803

Please sign in to comment.