Coder Social home page Coder Social logo

numaru / vscode-ceedling-test-adapter Goto Github PK

View Code? Open in Web Editor NEW
35.0 6.0 11.0 549 KB

Ceedling Test Adapter for the VS Code Test Explorer

License: MIT License

TypeScript 100.00%
ceedling vscode-extension test-driven-development c embedded testing test

vscode-ceedling-test-adapter's Introduction

Ceedling Test Explorer for Visual Studio Code

Run your Ceedling tests using the Test Explorer UI.

Screenshot

Features

  • Shows a Test Explorer in the Test view in VS Code's sidebar with all detected tests and suites and their state
  • Adds CodeLenses to your test files for starting and debugging tests
  • Adds Gutter decorations to your test files showing the tests' state
  • Adds line decorations to the source line where a test failed
  • Shows a failed test's log when the test is selected in the explorer
  • Lets you choose test suites that should be run automatically after each file change
  • Can be set up to report compiler and linker problems inline in the editor and in the Problems panel.

Getting started

  • Install the extension and restart VS Code
  • Open the workspace or folder containing your Ceedling project
  • Configure your project.yml path in the VS Code's settings if required see below
  • Configure the shell path where Ceedling is installed in the VS Code's settings if required (It might be required on Windows) see below
  • Enable the xml_tests_report Ceedling plugin in your project.yml see the Ceedling doc
  • Open the Test view
  • Run your tests using the Run icons in the Test Explorer or the CodeLenses in your test file

Configuration

Options

Property Description
ceedlingExplorer.projectPath The path to the Ceedling project (where the project.yml is) to use (relative to the workspace folder). By default (or if this option is set to null) it use the same path as the workspace folder.
ceedlingExplorer.shellPath The path to the shell where Ceedling is installed. By default (or if this option is set to null) it use the OS default shell.
ceedlingExplorer.debugConfiguration The Debug configuration to run during debugging. See Debugging for more info.
ceedlingExplorer.prettyTestLabel The test label is prettier in the test explorer, that mean the label is shorter and without begin prefix. E.g. inactive test_BlinkTaskShouldToggleLed, active BlinkTaskShouldToggleLed
Inactive:
prettyTestLabelInactive
Active:
prettyTestLabelActive
ceedlingExplorer.prettyTestFileLabel The test file label is prettier in the test explorer, that mean the label is shorter, without begin prefix, path and file type. E.g. inactive test/LEDs/test_BlinkTask.c, active BlinkTask
Inactive:
prettyTestFileLabelInactive
Active:
prettyTestFileLabelActive
ceedlingExplorer.testCommandArgs The command line arguments used to run Ceedling tests. The first argument have to litteraly contain the ${TEST_ID} tag. The value ["test:${TEST_ID}"] is used by default. For example, the arguments "test:${TEST_ID}", "gcov:${TEST_ID}", "utils:gcov" can be used to run tests and generate a gcov report.
ceedlingExplorer.problemMatching Configuration of compiler/linker problem matching. See Problem matching section for details.
ceedlingExplorer.testCaseMacroAliases An array of aliases for the TEST_CASE macro. By default it is ["TEST_CASE"]
ceedlingExplorer.testRangeMacroAliases An array of aliases for the TEST_RANGE macro. By default it is ["TEST_RANGE"]
ceedlingExplorer.ansiEscapeSequencesRemoved Should the ansi escape sequences be removed from ceedling stdout and stderr. By default it is true

Problem matching

Problem matching is the mechanism that scans Ceedling output text for known error/warning/info strings and reports these inline in the editor and in the Problems panel. Tries to resemble VSCode Tasks problemMatchers mechanism.

problems

Problem matching configuration options:

Property Description
mode Mode of problem matching. It is either "disabled", uses preset (i.e. "gcc") or uses custom "patterns" from patterns array. Default is "disabled".
patterns Array of custom pattern objects used for problem matching. If mode is set to "patterns", Ceedling output is scanned line by line using each pattern provided in this array. Default is empty array.

Example configuration which is sufficient in most cases:

"ceedlingExplorer.problemMatching": {
	"mode": "gcc"
}

Problem matching pattern options:

Property              Description
scanStdout Scan stdout output for problems. Default is false.
scanStderr Scan stderr output for problems. Default is true.
severity Severity of messages found by this pattern. Correct values are "error", "warning" and "info". Default is "info".
filePrefix Used to determine file's absolute path if file location is relative. ${projectPath} replaced with project path. Empty string means that file location in message is absolute. Default is empty string.
regexp The regular expression which is used to find an error, warning or info in the output line. ECMAScript (JavaScript) flavor, with global flag. Tip: you may find regex101 useful while experimenting with patterns. This property is required.
message Index of the problem's message in the regular expression. This property is required.
file Index of the problem's filename in the regular expression. This property is required.
line Index of the problem's (first) line in the regular expression. Not used if null or not defined.
lastLine Index of the problem's last line in the regular expression. Not used if null or not defined."
column Index of the problem's (first) column in the regular expression. Not used if null or not defined.
lastColumn Index of the problem's last column in the regular expression. Not used if null or not defined.

Example pattern object (GCC compiler warnings):

{
    "severity": "warning",
    "filePrefix": "${projectPath}",
    "regexp": "^(.*):(\\d+):(\\d+):\\s+warning:\\s+(.*)$",
    "message": 4,
    "file": 1,
    "line": 2,
    "column": 3
}

Commands

The following commands are available in VS Code's command palette, use the ID to add them to your keyboard shortcuts:

ID Command
ceedlingExplorer.clean Run ceedling clean
ceedlingExplorer.clobber Run ceedling clobber
test-explorer.reload Reload tests
test-explorer.run-all Run all tests
test-explorer.run-file Run tests in current file
test-explorer.run-test-at-cursor Run the test at the current cursor position
test-explorer.cancel Cancel running tests

Debugging

To set up debugging, create a new Debug Configuration. ${command:ceedlingExplorer.debugTestExecutable} can be used access the .out test executable filename being ran. Depending on your Ceedling configuration these can be found in projectPath/build/test/out/. Then, edit the ceedlingExplorer.debugConfiguration settings with the name of the Debug Configuration to run during debug.

Note: Individual test debugging is not supported. Instead the entire test file will be ran, so skip or remove breakpoints accordingly.

Example configuration with Native Debug (webfreak.debug):

{
    "name": "Ceedling Test Explorer Debug",
    "type": "cppdbg",
    "request": "launch",
    "program": "${workspaceFolder}/build/test/out/${command:ceedlingExplorer.debugTestExecutable}",
    "args": [],
    "stopAtEntry": false,
    "cwd": "${workspaceFolder}",
    "environment": [],
    "externalConsole": false,
    "MIMode": "gdb",
    "miDebuggerPath": "C:/MinGW/bin/gdb.exe",
    "setupCommands": [
        {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
    ]
}

Known issues

  • Cannot use both the junit Ceedling plugin and the xml plugin required by this extension because they are using the same ouput filename by default. If the version of the Ceedling you are using is greather than 0.28.3, you should be able to configure the output filename. #20

Troubleshooting

If you think you've found a bug, please file a bug report.

vscode-ceedling-test-adapter's People

Contributors

bzielinskib avatar cezarygapinski avatar eighthmayer avatar korigod avatar numaru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vscode-ceedling-test-adapter's Issues

UNRESPONSIVE extension host: 'numaru.vscode-ceedling-test-adapter' when using ceedlingExplorer.testCaseMacroAliases

Hi,

For version 1.10.1 I experience

[warning] UNRESPONSIVE extension host: 'numaru.vscode-ceedling-test-adapter' took 97% of 5184.417ms, saved PROFILE here: 'file:///tmp/exthost-f33d44.cpuprofile' [{"id":"numaru.vscode-ceedling-test-adapter","total":5005607,"percentage":97},{"id":"program","total":178571,"percentage":3}]

when

"ceedlingExplorer.testCaseMacroAliases": [
        "TEST_VALUE"
      ]

It doesn't get stuck for any other value for testCaseMacroAliases but then the only alias used in our code is TEST_VALUE

Test Explorer always reloading tests

The UI stays on this state forever. The workspace has only a ceedling initial project with only one test. I got no problems running tests over the terminal.

image

When a test fails, all subsequent tests will fail

Hi,

I'm facing an issue. The test results returned by the plugin are not correct. I don't know if it's related, but I'm not getting any output in the "Output" window. I'm on latest windows 10, with latest VS Code (1.40.1) and latests plugin versions (1.4.1 and 2.14.6).

$ ceedling version
  Ceedling:: 0.28.3
CException:: 1.3.1.18
     CMock:: 2.4.6.217
     Unity:: 2.4.3.122

$ ruby --version
ruby 2.4.4p296 (2018-03-28 revision 63013) [x64-mingw32]

$ gcc --version
gcc.exe (Rev2, Built by MSYS2 project) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1. Some tests are always returning error, even when they pass when run manually (in my project test_HW_test_flash passes if run on the command line, but not if run via the panel)
  2. Some tests pass, so it's not that it always return an error (in my project, test_LED always passes)
  3. Running all the tests will make all the tests after the first error appear as error (test_LED will fail if run via the "run all" button).
  4. I'm not getting output in the Output windon. In a multifolder environment, I get the "failed to find project.yml" message on those folders that have no tests, but I don't get any output when running the tests.

This screenshot shows how test_HW_test_flash passes in the command line, but appears as failed when run via VS Code. Also, it shows how the output console shows an error message on a folder without a ceedling project (As expected) but that there is no other output, even both failed and passed tests haven been run.

image

Project path is not resolved correctly in version 1.8.0

Hi,

Starting my work today I was surprised to find that the adapter stopped detecting my Ceedling project correctly with standard message: Failed to find the project.yml file. Please check the ceedlingExplorer.projectPath option. The important factor is that my project.yml file is not present in root workspace directory.

As this seemed a bit odd I have tried to find the root cause of the problem. Downgrading version to 1.7.0 solves the issue. In my opinion the problem is caused by this commit: 8a55e09 , especially the line 241:

 if (!(fs.existsSync(absolutePath) && !fs.lstatSync(absolutePath).isDirectory())) {

I guess what you tried to achieve is to enter fallback path in case specified path does not exist or points to a file instead of a directory. However, in my case the expression evaluates to true and function takes fallback defaultProjectPath path. I guess that this change should solve the problem:

if (!fs.existsSync(absolutePath) || !fs.lstatSync(absolutePath).isDirectory()) {

Test explorer not working with parameterized tests

Hello !

I have the following test:

/**
 * @brief Check that we handle incorrect values
 */
TEST_CASE( "0x123", 10)
TEST_CASE( "abc", 10)
void test_convertStrToSignedNumber_invalid_input(char *input, uint8_t base)
{
  long value;
  enum app_ecode_e rc;

  rc = convertStrToSignedNumber(input, &value, base);
  TEST_ASSERT_EQUAL( rc, APP_ECODE_BAD_PARAMETER );

}

When I am trying to run it, the status is not updated in the test explorer interface. The test is a success in the report.

image

I do not have any problems with tests which are not parameterized.

image

Seems like parameterized tests is not supported by the extensions ? May be I need to add some options ?

Thanks a lot !

Complains about not being able to run the project in non-ceedling projects

Description

In non-C projects and C projets not using Ceedling, the following error shows on startup:

Ceedling failed to run the project. Please check the ceedlingExplorer.projectPath option.

AFAIK, this issue wasn’t present in 1.0.0 but is there since 1.1.0.

Steps to reproduce

  1. Install vscode-ceedling-test-adapter
  2. Open a non-Ceedling project

How to configure ceedling command line

Hi,

First of all thanks for the great plugin.
I would like to know how I can configure ceedling plugin in vs code to run the command line
ceedling gcov:all

I understand that it always runs the option ceedling test:all.

Thanks.

Can't figure out how to set up debugger

Hi,

I can't figure out how to set up the debugger, the README is pretty unclear (at least for somebody unfamiliar with ceedling).

I copy/pasted the following into my settings file, but I am still getting the same error:

{
    "name": "Ceedling Test Explorer Debug",
    "type": "cppdbg",
    "request": "launch",
    "program": "${workspaceFolder}/build/test/out/${command:ceedlingExplorer.debugTestExecutable}",
    "args": [],
    "stopAtEntry": false,
    "cwd": "${workspaceFolder}",
    "environment": [],
    "externalConsole": false,
    "MIMode": "gdb",
    "miDebuggerPath": "C:/MinGW/bin/gdb.exe",
    "setupCommands": [
        {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
    ]
}

Is there a part of this that I need to fill in, or something? I don't know what a debug configuration is, or how to specify them.

unable to open test file (Error: file not found) while debugging, but the test runs and terminates anyway

My tests run fine when I run them normally. When I debug I get this error even though the terminal still shows test output. Interestingly enough, I can set breakpoints, it will wait at the breakpoint and I can tell it to continue but I can't see what line the debugger is on. Every time I click on the topmost line in the call stack, the error disappears and instantly reappears.

The location it is trying to load the test file from is where it used to be, but I move the whole ceedling project into another folder when I started using visual code. But I can't seem to figure out why it is trying to read the source test file from this location. I used the debugger configuration from here and I only changed the debugger path. If I mess around with the other settings there the process stops with an error much sooner.

Here is what it looks like when I try to debug

When xml and junit test report is enabled plugin doesn't work

When xml_tests_report and junit_tests_report is enabled the extension doesn't work, it stuck on the testing stage.
image

Removing junit_tests_report makes it work again.

:plugins:
  :load_paths:
    - vendor/ceedling/plugins
  :enabled:
    - xml_tests_report
    - junit_tests_report
    - stdout_pretty_tests_report
    - module_generator
    - raw_output_report
    - gcov

Tests do not load after upgrade to 1.10.0

In the Side panel, no tests show up with the version v1.10.0

This is the case for native Windows and WSL. After downgrading the Ceedling test adapter plugin to v1.9.1 the tests reappear.

Using a script for shell path

I am utilising a docker environment for development.
I currently am using a script to run things inside that docker container. My test tasks run the following command

run-in-docker.ps1 nrf ceedling
image

I have tried setting the shell path as
"ceedlingExplorer.shellPath": "\"C:\\Program Files\\PowerShell\\7\\pwsh.exe\" -Command run-in-docker.ps1 nrf"
And this works from a command prompt, and if I append ceedling it runs ceedling as expected

But I get an error when using the test explorer
Ceedling failed to run in the configured shell. Please check the ceedlingExplorer.shellPath option.

can not run *.out files on windows

Hello,

command:ceedlingExplorer.debugTestExecutable always expects to find an *out.file
On windows there are *.exe files.
There must be a way to change from *.out to *.exe

Edit:
changing the exension variable in the ceedling project.yml to .out actually works.

Suggestion:; this extension should look for the variable executable in the project.yml and set the ending of the command ceedlingExplorer.debugTestExecutable accordingly

Add a log to catch the bugs in user env

A log the user can put in a bug report should make the bug reproduction faster.
The log must be easy to access by user.
It must be specified to the user to enclose this log in the bug report.

different ceedling folder causes tests to be shown as failed alltough they succeed

Hi,

My vendor/ceedling folder used to be in my project root.

Now I changed the location to a subfolder (library/vendor/ceedling)
In my project root there are still the files "project.yml" and "ceedling.cmd".
In project.yml I changed the following configurations:
:project:
:which_ceedling: library/vendor/ceedling
...
:plugins:
:load_paths:
- library/vendor/ceedling/plugins

My tests run in the console successfully.
Also in the test explorer I can see in the console output that they all run successfully, but they will be shown as failed.

Is this a bug or did I miss to set something?

Multiline test function names are not picked up

Since my test function names are starting to get very long, I started to use multiple lines like so:

void test_
GIVEN_xxxxxxxxxx__
WHEN_xxxxxxxxxxxxxx__
THEN_xxxxxxxxxxxxxxxxxx(void)
{
}

Ceedling is not having any problems with this notation, but the test-adapter is unfortunately not able to find the test functions in that case.

Remove error nodes on workspace folders which have no project.yml

Hi,

Sorry for reopening a closed ticket, but I don't understand how this was fixed. I have a workspace with three folders (my source code in /src, some docs in /doc and the tests in /test). I keep them separated so I can get different c_cpp_settings.json for source and for tests, for example.
When I open the test explorer, I get two errors on the two workspaces that are not ceedling projects. How can I get rid of them?

image

I set the extension settings in the folder level, so only the test folder has the right path to the "project.yml" file (the other two have the default '.', and I think the extension is searching in /src and in /docs for a project.yml). As you said, it's better to get the error so the user can see that the problem comes from the extension is unable to get the settings, but maybe there should be a way to say "this folder doesn't contain one, that's why you can't find it, don't search".

Originally posted by @joel-felcana in #9 (comment)

Add option to execute ceedling in another shell

Windows users might have installed Ceedling in an alternative env (e.g. MinGw to get easier access to gcc).
The extension must provide an option to get the path to the shell where ceedling is installed.
It should warn the user if ceedling is not correctly executed and ask him to check this option.

It might fix this issue #2

Cannot debug ceedling program

Hi there,

Thanks for the plugin - it's been great for running tests!

My problem is that I can't seem to get debugging to work.

When I try to debug, I get a launch: program 'D:\tdd_sandbox\build\test\out\' does not exist error.

In settings, I have set the following:
Debug configuration to run during test debug: Ceedling Debug
Ceedling Explorer: Project Path: .
Ceedling Explorer: Shell Path: null

In launch.json, I have the following:
image

My folder structure is as follows:
image

Do you see what could possibly be wrong here?

Unsupported option leads to misleading "Unable to find project file"

Hi everyone

I'm using the following ceedling option in the project.yml

 :gcov:
     :html_report_type: basic

When that's enabled, test explorer throws the infamous
Failed to find the project.yml file. Please check the ceedlingExplorer.projectPath option.

VSCODE
Version: 1.76.2
Commit: ee2b180d582a7f601fa6ecfdad8d9fd269ab1884
Date: 2023-03-14T17:57:21.103Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Linux x64 5.15.0-67-generic snap
Sandboxed: No

Ceedling Test Explorer: 1.10.1

Remote Extension host terminating unexpectedly when trying to use ceedling test adapter

Hi!

So i recently downloaded ceedling (0.31.1) and wanted to give it a try with vscode 1.69.1.

I was using the temperature sensor example from ceedling to test out the tool and the ceedling test adapter, but for some reason the testing tap just shows Ceedling: Error. The only information I get is that there was an error loading tests and when I click on it I dont get any more info on the error.

The Test Explorer: Reloading Tests is constantly running and eventually the pannel reloads itself and I get a message stating "Remote Extension host terminated unexpectedly".

The thing is that I normally work in a remote server to which i connect to by ssh, and I develop all my code and tests there. I dont have linux locally so I can not test if this problem araises from the remote connection alone or if I am doing something wrong, but im quite sure I ran all the setup steps correctly, as shown in the extension page.

Let me know if I can provide any more information.

Best regards,
Gabriel.

Cannot run debug gdb with multiple folders in a workspace

Hello,
I have followed steps to run Ceedling tests using VS Code. The tests run ok, however when I click the debug icon I have the following messages;
image

I have setup the debug launch etc, I have used in the past no problem and pointed to ceedling_gdb.

    {
        "name": "ceedling_gdb",
        "type": "cppdbg",
        "request": "launch",
        "program": "${workspaceFolder}/ceedling/build/test/out/${command:ceedlingExplorer.debugTestExecutable}",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": true,
        "MIMode": "gdb",
        "miDebuggerPath": "C:/msys64/mingw32/bin/gdb.exe",
        "setupCommands": [
            {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }
        ]
    },

xml_reports plugin is required but does not work

Basically, when I enable the xml_reports plugin I run into this issue:

ceedling test:all C:/Ruby25/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in require':
cannot load such file -- C:/Undagrid/repositories/stm_undabedded/ceedling/vendor/Ceedling/vendor/cmock/lib/cmock_generator_plugin_xml_tests_report.rb `

I tried resolving this issue here: http://www.throwtheswitch.org/forums?place=msg%2Fthrowtheswitch%2F68DPra-CpGM%2F3y1oPLfYBgAJ. Since then I've been in contact with Mark from Ceedling. He is aware of the issue and it should be resolved with the next release.

Meanwhile, this plugin is still required to run the ceedling test adapter for visual studio and I'm seeing other people post issues I did not run into before. So I assume other people here have found a workaround or I am somehow on the wrong version of Ceedling. I have tried using the latest release of ceedling as well as the up to date code on the master branch. Nothing works. Is there an older version of Ceedling I need to use? I tried v0.28.2 but ran into the same issue. With older versions I'm running into different issues. Should I try to fix those issues so I can try the even older versions? Maybe there's simply another option I'm missing that will fix it? Any help is greatly appreciated.

Windows 7: Ceedling failed to run in the configured Shell

I'm using the ceedling test adapter on Windows 7.
No matter what I tried to configure the shell to, the only output I get is Ceedling failed to run in the configured Shell. I tried the following values for "ceedlingExplorer.shellPath: "

  • null
  • "null"
  • cmd.exe
  • C:\Windows\System32\cmd.exe
  • C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Option to load report xml from gcov directory

(Code-Reference: https://github.com/numaru/vscode-ceedling-test-adapter/blob/master/src/adapter.ts#L692)

Currently the report xml is always loaded from the artifacts/test/ directory, but doing ceedling gcov:<test> writes the report to artifacts/gcov/ instead. So one must run both gcov:${TEST_ID} (to get the coverage) and test:${TEST_ID} (so this adapter can find the xml).

This means running the tests twice, when the report.xml could instead just be read from the gcov directory instead.

Working project.yml is not being loaded in vscode

Hi

I have a pretty complex project (see below). It works reliably on the command line, but in VSCode it makes the plugin output "project file not found".

I take it that something is going wrong, so how can I debug it?


# Main ceedling project file

:project:
  :use_exceptions: false
  :build_root: .build/test
  :test_file_prefix: test_
  :which_ceedling: gem
  :use_mocks: true
  :compile_threads: 4
  :test_threads: 4
  :use_test_preprocessor: true
  :test_file_prefix: test_
  :which_ceedling: gem
  :default_tasks:
    - clobber test:all
  :options_paths:
    - ./test/options/

:paths:
  :test:
    - +:test/**
    - -:test/support
  :include: # Any header files not already in the source search path.
    - include/**
    - .build/src/**
  :source:
    - src/**
  :support:
    - test/support
  :libraries:
    - "#{PROJECT_ROOT}/.build/subprojects/glog/"

:cmock:
  :mock_prefix: mock_
  :when_no_prototype: warn
  :enforce_strict_ordering: true
  :plugins:
    - :ignore
    - :ignore_arg
    - :array
    - :callback
    - :return_thru_ptr
  :treat_as:
    uint8: HEX8
    uint16: HEX16
    uint32: UINT32
    int8: INT8
    bool: UINT8
  :treat_as_array: va_list

:defines:
  # in order to add common defines:
  #  1) remove the trailing [] from the :common: section
  #  2) add entries to the :common: section (e.g. :test: has TEST defined)
  :commmon: &common_defines
    - G_LOG_DOMAIN=0
    - G_LOG_LEVEL_MESSAGE=0
    - G_LOG_LEVEL_DEBUG=1
  :test:
    - *common_defines
    - TEST
  :test_preprocess:
    - *common_defines
    - TEST

:plugins:
  :load_paths:
    - "#{Ceedling.load_path}"
  :enabled:
    - stdout_pretty_tests_report
    - gcov
    - xml_tests_report

:gcov:
  :abort_on_uncovered: true
  :uncovered_ignore_list:
    - src/main.c
  :reports:
    - HtmlDetailed
  :gcovr:
    :html_medium_threshold: 75
    :html_high_threshold: 90
    :exclude_unreachable_branches: true
    :report_include: "^src/"
    :report_exclude: "^.build/"

:flags:
  :test:
    :compile:
      :*:
        - -std=c99
        - -fshort-enums
        - -Wall
        - -Wextra
        - -Wstrict-prototypes
        - -Wunreachable-code
        - -g

  :gcov:
    :compile:
      :*:
        - -std=c99
        - -fshort-enums
        - -Werror
        - -Wall
        - -Wextra
        - -Wstrict-prototypes
        - -Wunreachable-code

Linux, Ceedling failed to run in the configured shell, how to troubleshoot?

I have set the ceedlingExplorer.shellPath to point to the proper location (somewhere where ceedling binary is located, one level before).

Yet I am still getting this message

Ceedling failed to run in the configured shell. Please check the ceedlingExplorer.shellPath option.

I am not that knowledgeable about VSCode yet as to understand how I can troubleshoot what is happening. I am using VScode on Windows with a Remote environment using SSH on Linux CentOS7

In the Terminal plugin within vscode, I can confirm my paths are correct, that the binary is working fine. I can use my test script to run the ceedling test as well. The VScode ceeding plugin is the only place where things fall apart.

Support for other VS distribution, eg Atmel Studio

HI,

I tried to install .vsix file into Win10 with installed AtmelStudio7 and got following log:

1/9/2020 2:52:26 PM - Microsoft VSIX Installer
1/9/2020 2:52:26 PM - -------------------------------------------
1/9/2020 2:52:26 PM - Initializing Install...
1/9/2020 2:52:26 PM - Extension Details...
1/9/2020 2:52:26 PM - Identifier : vscode-ceedling-test-adapter
1/9/2020 2:52:26 PM - Name : Ceedling Test Explorer
1/9/2020 2:52:26 PM - Author : numaru
1/9/2020 2:52:26 PM - Version : 1.4.2
1/9/2020 2:52:26 PM - Description : Run your Ceedling tests in the Sidebar of Visual Studio Code
1/9/2020 2:52:26 PM - Locale : en-US
1/9/2020 2:52:26 PM - MoreInfoURL :
1/9/2020 2:52:26 PM - InstalledByMSI : False
1/9/2020 2:52:26 PM - SupportedFrameworkVersionRange : [0.0,2147483647.2147483647]
1/9/2020 2:52:26 PM -
1/9/2020 2:52:26 PM - Supported Products :
1/9/2020 2:52:26 PM - Microsoft.VisualStudio.Code
1/9/2020 2:52:26 PM - Version :
1/9/2020 2:52:26 PM -
1/9/2020 2:52:26 PM - References :
1/9/2020 2:52:26 PM -
1/9/2020 2:52:26 PM - Searching for applicable products...
1/9/2020 2:52:27 PM - Found installed product - Global Location
1/9/2020 2:52:27 PM - Found installed product - AtmelStudio
1/9/2020 2:52:27 PM - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
at VSIXInstaller.App.InitializeInstall(Boolean isRepairSupported)
at VSIXInstaller.App.InitializeInstall()
at System.Threading.Tasks.Task.InnerInvoke()

So, problem is cause because AtmelStudio isn't supported. Is it possible or do you plan to support AtmelStudio?

Thanks in advance

Unable to debug test when specific preprocessor definitions are set

When special preprocessor definitions for test are specified in ceedling project.yml then is not possible to debug this specific test.
Ceedling create executable file not in build/test/out but in additional subdirectory named like the executable without extension.

For example when we have temp_sensor project you can add this to :defines: section:

:defines:
  :TestAdcHardware:
    - *common_defines
    - TEST
    - SPECIAL_DEF

After creating test the path to output looks like this: build/test/out/TestAdcHardware/TestAdcHardware.out instead of build/test/out/Test/TestAdcHardware.out what cause problem with launching the file to debug.

Is it possible to modify ceedlingExplorer.debugTestExecutable after first failure when output is not found for debug in standard path, add subdirectory to the current path and try to start debug again?

Coloured output is not handled

When enabling Unity's coloured_report plugin, which turns pass/fail results green/red, the test explorer's output doesn't handle the control characters:

image

Expected behaviour: at least it should remove the control characters from the output. Ideally it would colour the output properly.

Note, that VSCode's terminal does handle the colours properly:

image

Be able to use TEST_VALUE instead of TEST_CASE (https://github.com/ThrowTheSwitch/Ceedling/issues/195)

We have to use the workaround described at ThrowTheSwitch/Ceedling#195. There is a solution to avoid this workaround (ThrowTheSwitch/Ceedling#497) but in involves compiler-specific flags for modifying macro processing behaviour. This workaround breaks our existing test cases.

Hence, @numaru, could I please have an extension setting enabling me to tell the extension to use TEST_VALUE (or arbitrary string) instead of TEST_CASE? The same applies to TEST_RANGE.

Migrating to native testing

In version 1.59, VS Code added an official API and UI for running tests. Use it instead of Test Explorer UI, which is now deprecated

Support monorepo projects

While the configuration option ceedlingExplorer.projectPath adds support for a project root which is not the current workspace root, it does not handle workspaces with multiple subprojects.

For instance, let’s imagine the following layout:

*
|--A
|  |-- x
|  |-- project.yml
|
|--B
   |-- x
   |-- project.yml

Currently, I can do:

{
    "ceedlingExplorer.projectPath": "A"
}

However, if I want to switch to project B, I need to update the project path. It would be great if I was able to do something like:

{
    "ceedlingExplorer.projectPath": "A:B"
}

The path separator could be : as in the PATH variable, or ;.

Ceedling failed to run in the configured shell

I am using ceedling in WSL. So, I configured "ceedlingExplorer.shellPath": "C:/WINDOWS/System32/wsl.exe". But it showed "Ceedling failed to run in the configured shell. Please check the ceedlingExplorer.shellPath option." Did I configure it wrong?

Test explorer UI shows wrong results

Hi,

I'm using remote containers and I have configured a simple sample project. When I run from the command line ceedling test:all it runs properly and the results are shown, also the JunitXML file is generated, so it seems to be working fine.

$ ceedling test:all

Test 'test_gfserver.c'
----------------------
Running test_gfserver.out...

-------------------
FAILED TEST SUMMARY
-------------------
[test_gfserver.c]
  Test: test_true
  At line (4): "Bug!"

--------------------
OVERALL TEST SUMMARY
--------------------
TESTED:  1
PASSED:  0
FAILED:  1
IGNORED: 0

---------------------
BUILD FAILURE SUMMARY
---------------------
Unit test failures.

When I run it from the Test Explorer UI I still can see how the XML file is generated (tried after a ceedling clobber) but the results are not shown properly in the UI. There is nothing in the console output or problems tab. Any hints on how to fix it or debug what is going on?

image

$ ceedling version
   Ceedling:: 0.31.0
      Unity:: 2.5.2
      CMock:: 2.5.3
 CException:: 1.3.3

Support differents project.yml configuration files

I'd like to use different project.yml configuration files, because I've a project with different configurations and every configuration has its own defines.

The Ceedling manual says:

To use a project file name other than the default project.yml or place the project file in a directory other than the one in which you'll run Rake, create an environment variable CEEDLING_MAIN_PROJECT_FILE with your desired project file path.

So, i'm able to run different *.yml files by vscode terminal
SET CEEDLING_MAIN_PROJECT_FILE=custom_project.yml && ruby vendor/ceedling/bin/ceedling

Unfortunately, the Ceedling Test Adapter is not able to set this variable

Can you add the support to run different project.yml files?

For example, you can recognize every *project,yml in the root directory?

Thank you!

ceedling 0.32.0 release candidate breaks test result reporting

I am trying to use the 0.32.0 release candidate because 0.31 doesn't play nice with modern versions of ruby. I got the tests to run, but the test explorer is showing error triangles. it looks like the default location for test report has moved to build/artifacts/report.xml. setting the path in project.yml seems to fix the issue.

:xml_tests_report:
  :artifact_filename: "report.xml"
  :path: "build/artifacts/test/"

image

test output

stdout:

Collecting Definitions
------------------------

Getting Includes From Test Files
--------------------------------

Determining Requirements

Preprocessing Header Files
--------------------------

Generating Mocks
----------------

Preprocess Test Files

Determining Objects to Be Built

Generating Runners
------------------

Preparing to Build

Building Objects
----------------

Building Test Executables
-------------------------
Linking test_b2bComm.out...

Executing
---------
Running test_b2bComm.out...

--------------------
OVERALL TEST SUMMARY
--------------------
TESTED:  2
PASSED:  2
FAILED:  0
IGNORED: 0

report.xml

<?xml version='1.0' encoding='utf-8' ?>
<TestRun>
	<FailedTests/>
	<SuccessfulTests>
		<Test id="1">
			<Name>test/mware/comm/test_b2bComm.c::test_B2b_Init</Name>
		</Test>
		<Test id="2">
			<Name>test/mware/comm/test_b2bComm.c::test_B2b_Receive</Name>
		</Test>
	</SuccessfulTests>
	<IgnoredTests/>
	<Statistics>
		<Tests>2</Tests>
		<Ignores>0</Ignores>
		<FailuresTotal>0</FailuresTotal>
		<Errors>0</Errors>
		<Failures>0</Failures>
	</Statistics>
</TestRun>

Extension does not work on Mac catalina, vscodium, oh-my-zsh shell

Hello,
I have installed and use this configuration on mac catalina with vscodium and oh-my-zsh shell.
No matter what the value of
"ceedlingExplorer.shellPath": is set to, the test explorer is not discovering any tests.
I have tried with various combinations of zsh, sh, bash, null with and without double quotes.

I get the usual

Ceedling failed to run in the configured shell. Please check the ceedlingExplorer.shellPath option.

/bin/sh: ceedling: command not found
zsh:1: command not found: ceedling
bash: ceedling: command not found

Ceedling is installed as a gem and is available on the system path. In fact, I tried it on an existing project to test the extension.

And yes, the xml_reports plugin is enabled in the plugins section of the project.yml.

I would be grateful if anyone can help me fix this issue. I am guessing I am doing something wrong.. but am unable to figure out where.

Add diagnostics (entries on problems tab) for warnings and errors

Hello!

I'd like to add diagnostics reporting mechanism similar to VSCode's Tasks ProblemMatchers (unfortunately it's not possible to use them directly from extensions, as far as I know). Main idea is to parse stderr with regular expression(s) to get compiler messages for errors and warnings, and if there is any - add them to VSCode problems tab.

I'm not sure if it's worth a separate issue so I'll say it here - also for this to work better, I need to add an option to run suits with "clobber", so everything would be rebuilt on every run, and report warnings properly. Actually I think this option currently would be useful on it's own, because Ceedling sometimes fail to recognize that rebuild is necessary - for example on project.yml or mocked header changes. Edit: figured out it's already possible to do this via testCommandArgs setting.

What do you think about that?

ShellPath issue: please help me figure it out

Hello

First of all thank you for making this extension, I was just trying to make a build configuration and was going crazy.
Happy to see someone made a complete extension!!! 👏

My environment is the following:
Operating System: Win10
toolchain: C:\Qt\Qt5.12.10\5.12.10\mingw73_32\bin
shell: git-bash
ceedling: via rake binaries in path

    Ceedling:: 0.30.0
       CMock:: 2.5.2
       Unity:: 2.5.1
  CException:: 1.3.2

so when I'm in my gitbash I can just do the ceeling test:mytest
VSCode is loaded with the same global environment

I saw another issue and created a call-ceedling.bat with this content
call C:\Program Files\Git\bin\bash.exe /c %2

and put this into my vs
"ceedlingExplorer.shellPath": "C:/Program Files/Git/call-ceedling.bat"
Also tried with git bash straight
"ceedlingExplorer.shellPath": "C:/Program Files/Git/bin/bash.exe"

And yet it says
Ceedling failed to run in the configured shell. Please check the ceedlingExplorer.shellPath option.

What am I missing here?

Not currently debugging a ceedling project

Hi,

Since a couple of days ago I'm getting this error on a project that I would sweat it was working before, with no changes whatsoever (apart from VS Code or other extensions updating).

I have all the settigns on their default values, except the debug taks, which points to the right debug task. It seems that the extension can't (or can but doesn't) translate the ${command:ceedlingExplorer.debugTestExecutable} variable, and the program name passed to the debugger is just getting the folder path, but not the .out for this specific test. Replacing the variable with the harcoded file I want to debug works, as expected.

image

Any ideas? I set my settings at the folder level, because I work in a multifolder workspace, but settings are not being overriden by workspace or user settings. My default console can run ceedling and gcc, and the run test function works as expected.

Configuration 'true' is missing in 'launch.json'.

I installed the ceedling test exploer, it is ok for run the test case , but pops up "configuration true is missing in launch.json",

below is the lauch.json

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "Ceedling Test Explorer Debug",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}/build/test/out/${command:ceedlingExplorer.debugTestExecutable}",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${fileDirname}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "miDebuggerPath": "D:\\Program Files\\mingw64\\bin\\gdb.exe",
        "setupCommands": [
          {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
          }
        ],
        "preLaunchTask": "C/C++: g++.exe build active file"
      }
    ]
  }

below is the setting.json

{
    "files.associations": {
        "plc_core_def.h": "c"
    },
    "ceedlingExplorer.debugConfiguration": "true",
    "ceedlingExplorer.problemMatching": {
        "mode": "gcc"
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.