Skip to content

Understanding and resolving issues examples

Example: define Boolean checker

OSC2 code: define Boolean checker
import "$FTX/env/basic/exe_platforms/model_ssp/config/model_sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/highway.xodr"
    set test_drain_time = 0second
    set implicits_kind = none

extend issue_kind: [sut_too_fast]

extend top.main:

    on (sut.car.state.speed > 80kph):
        call sut_error(sut_too_fast,
            "SUT speed too high: $(sut.car.state.speed)")


    do sut.car.drive() with:
        speed(70kph, at: start)
        speed([90..100]kph, at: end)
        duration([5..20]second)

Example: incomplete scenario example

OSC2 code: incomplete scenario example
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"


extend top.main:
    car1: vehicle
    do serial:

        car1.drive() with:
            speed([20..50]kph, at: end)

Example: constrain NPC to move relatively to SUT

OSC2 code: constrain NPC to move relatively to SUT
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"


extend top.main:
    car1: vehicle

    do parallel(overlap:equal):
        sut.car.drive() with:
            speed([35..50]kph)      # this modifier is required because of
                                    # the relative constraint on car1's speed
        car1.drive() with:
            # Faster than sut.car by [1..5]kph
            speed([1..5]kph, faster_than: sut.car)

Example: undefined simulator

OSC2 code: undefined simulator
extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"

extend top.main:
    do serial():
        sut.car.drive() with:
            speed([50..100]kph, at: all)

Example: modify() example

OSC2 code: modify() example
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"
    set min_test_time = 0second

extend issue_kind: [custom_kind]


extend top.main:
    on @top.new_issue:
        issues.curr.modify(custom_kind, info,
            "downgrading custom kind severity to ‘info’")

Example: modify_category() example

OSC2 code: modify_category() example
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"
    set min_test_time = 0second

extend issue_kind: [sensor_failure]


extend top.main:
    on @top.new_issue:
        issues.curr.modify_category(sensor_failure, other,
          "This issue is not due to a sensor failure.")

Example: change severity of sensor failure

OSC2 code: change severity of sensor failure
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"
    set min_test_time = 0second

extend issue_kind: [sensor_failure]

scenario scenario1

extend top.main:
    do scenario1: scenario1()


extend top.main:
    on @new_issue if scenario1.is_running():
        issues.curr.modify(sensor_failure, warning,
            "In top.foo, if scenario1 is running, all sensor failures are warnings")

Example: change severity of sensor failure in run

OSC2 code: change severity of sensor failure in run
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"
    set min_test_time = 0second

extend issue_kind: [sensor_failure]


extend top.main:
    def ignore_sensor_failures(kind: issue_kind) is:
        if kind == sensor_failure:
            issues.curr.modify(sensor_failure, ignore,
                "In top.main, all sensor failures are ignored")

    on @new_issue:
        ignore_sensor_failures(issues.curr.kind)

Example: modify_severity_by_name()

OSC2 code: example of modify_severity_by_name()
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"
    set min_test_time = 0second

extend issue_kind: [sensor_failure]

extend top.main:

    # example
    on @top.new_issue:
        issues.curr.modify_severity_by_name("sensor_failure", warning, "Moving sensor failure check to warning")

Example: modify_category_by_name()

OSC2 code: example of modify_category_by_name()
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"
    set min_test_time = 0second

extend issue_kind: [sensor_failure]

extend issue_category: [sutv2]

extend top.main:

    # example
    on @top.new_issue:
        issues.curr.modify_category_by_name("sensor_failure", sutv2, "Moving sensor failure check to 'sutv2'")

Example: modify_kind_by_name()

OSC2 code: example of modify_kind_by_name()
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"
    set min_test_time = 0second

extend issue_kind: [sensor_failure]

extend top.main:

    # example
    on @top.new_issue:
        call issues.curr.modify_kind_by_name("sensor_failure", other, "Changing sensor failure issue kind to 'other'")

Example: define custom resolution logic

OSC2 code: define custom resolution logic
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"
    set min_test_time = 0second

extend issue_kind: [overspeed, sensor_failure]

enum speed_sensor_kind: [radar]

extend vehicle:
    var active_speed_sensor: speed_sensor_kind


extend top.main:
    on @new_issue:
        if (issues.curr.kind == overspeed and sut.car.active_speed_sensor == radar and sut.car.state.speed < 60kph):
            issues.curr.kind = sensor_failure
            issues.curr.severity = warning

Example: limit duplicate issues

OSC2 code: limit duplicate issues
import "$FTX_BASIC/exe_platforms/sumo_ssp/config/sumo_config.osc"

extend test_config:
    set map = "$FTX_PACKAGES/maps/hooder.xodr"
    set min_test_time = 0second

extend top.main:
    do log("hello")


extend issues:
    set max_duplicate_issues = 3

Example: Unsupported case 1 for constraint s == null

OSC2 code: Unsupported case 1
#Start_Header
#Constraining struct to be either null or non-null under a non deterministic condition is not supported yet
#End_Header

import "$FTX/qa/regression/config/no_simulation.osc"

struct S


extend top.main:
    flag: bool
    s: S
    keep(flag => s == null)

Example: Unsupported case 2 for constraint s == null

OSC2 code: Unsupported case 2
#Start_Header
#Constraining struct to be either null or non-null under a non deterministic condition
#End_Header

import "$FTX/qa/regression/config/no_simulation.osc"

struct S


struct base:
    f: bool
    s: S
struct derived1 inherits base(f == true):
    keep(s == null)
struct derived2 inherits base(f == false)

extend top.main:
    b: base

Example: Supported case for constraint s == null

OSC2 code: Supported case
import "$FTX/qa/regression/config/no_simulation.osc"

struct S

struct base:
    f: bool
    s: S
struct derived1 inherits base(f == true):
    keep(s == null)
struct derived2 inherits base(f == false)

extend top.main:

    b1: derived1
    b2: base with:
        keep(it.f == true)