I have a problem to add a source file to my QAC configuration. After many tries, I found out that the problem is with too many includes defined as an argument while calling QAC. If I will reduce the number of includes the QAC configuration will pass.
I tried this over the makefile:
#for f in $(filter-out $(QAC_EXCLUDE_FILES),$(QAC_SRC)); do \
echo " - $$f" 1>&2; \
$(QAC) admin -P $(QAC_DIR) -a -- $(QAC_DEF) $(QAC_D_PROJ) $(QAC_INC) $$f >/dev/null; \
done
I also tried to run a single command to add just one file in Command Prompt:
D:/Tools/PRQA_Framework_2.4.0/common/bin/qacli.exe admin -P D:/Output/qac -a -- -Itoo -Imany -Iincludes D:/Src/import.c
I'm pretty sure that the whole command line is not exceeding the limit 8191 characters (it is something about 5500 characters).
I'm using our common company QAC configuration like many of my colleagues without any problem. In the last few days I just add some new includes.
The result is always the same:
Calling from makefile: /usr/bin/sh: -c: line 3: syntax error:
unexpected end of file
Calling from CMD: CreateProcess error=3, the system cannot find
the path specified
But again, if I will just reduce the includes, everything goes nice and smooth.
Also, I would not say it is a problem of CMD because I'm using the same list of includes for my build process without any problem! It is only a problem for QAC.
My setup is Windows 10, MSYS2 tools.
At the and I contact the QAC support and better way how to provide all information to QAC is to generate list file (one line = line source file) with all defines and includes. This way is also much quicker than passing source files one by one.
So the file list qac_sources.txt (generated by makefile) may look like this:
D:/Project/a1.c -D__far_func= -IToo -Imany -Iincludes
D:/Project/a2.c -D__far_func= -IToo -Imany -Iincludes
D:/Project/a3.c -D__far_func= -IToo -Imany -Iincludes
D:/Project/a4.c -D__far_func= -IToo -Imany -Iincludes
And:
D:/Tools/qacli.exe admin -P D:/Project/Output/qac -F D:/Project/Output/qac/qac_sources.txt
Hope this will help somebody.
Related
I'm trying to learn how autocompletion works in zsh. I've got a simple script file (example.zsh) and I'm trying to create a simple autocomplete function that describes each of its parameters. In order to do that, I've started by creating a simple _example file which looks like this:
#compdef create_ca
_arguments \
"--caKey[name of the file that will hold the keys used for generating the certificate (default: ca.key)]" \
"--caCrt[name of the file that will hold the certificate with the public key (default: ca.crt)]" \
"--cn[common name for the root certificate (default: root.GRM)]" \
"--days[number of days that certificate is valid for (default: 10500)]" \
"--size[key size (default: 4096)]" \
"--help[show this help screen]"
The file is on the same folder as the script and I've updated my .zshrc file so that it adds that folder to the $fpath:
fpath=(~/code/linux_certificates $fpath)
autoload -Uz compinit
compinit -D
I'm using the D option so that the .zcompdump isn't generated. At first sight, everything worked out, but when I tried to update the helper autocomplete function, I'm unable to see thosee changes (ex.: changing the description). I've tried re-running the compinit command and, when using the cache .zcompdump, deleting that file. However, it simply didn't work. The only way I've managed to get it working was by deleting the autocomplete helper function with:
unfunction _create_ca
Is this the expected behavior? I mean, should't running compinit -D be enough to reload my helper autocomplete function?
btw, any good tutorials on how to create autocomplete functions (besides the official docs)?
thanks.
Once a function has been loaded, it will not be loaded again. That’s why you first have to unfunction your function, causing Zsh to unload it, so it can be loaded again.
Alternatively, you can just use exec zsh to restart your shell.
I may have missed this detail but I'm trying to see if I can control the set of plugins made available through the ini configuration itself.
I did not find that item enumerated in any of the configurable command-line options nor in any of the documentation around the pytest_plugins global.
The goal is to reuse a given test module with different fixture implementations.
#hoefling is absolutely right, there is actually a pytest command line argument that can specify plugins to be used, which along with the addopts ini configuration can be used to select a set of plugin files, one per -p command.
As an example the following ini file selects three separate plugins, the plugins specified later in the list take precedence over those that came earlier.
projX.ini
addopts =
-p projX.plugins.plugin_1
-p projX.plugins.plugin_2
-p projY.plugins.plugin_1
We can then invoke this combination on a test module with a command like
python -m pytest projX -c projX.ini
A full experiment is detailed here in this repository
https://github.com/jxramos/pytest_behavior/tree/main/ini_plugin_selection
I have several hundred behat tests created by many people who used different tags. I want to clean this up, and to start with I want to list out all the tags which have been used so far.
I wanted to answer my own question as it was something I could not find an answer to elsewhere.
I tried initially to use a custom formatter but that did not work.
https://gist.github.com/paulmozo/fb23d8fb436700381a06
Eventually I crafted a Bash command to suit my purposes
bin/behat --dry-run 2>&1 | tr ' ' '\n' | grep -w #.* | sort -u
This runs the behat command with --dry-run which does not execute the tests, merely outputs the steps so I can pipe them to another tool. The 2>&1 redirects the standard error to null (this is shell dependent). The tr tool breaks every word in the stream into a separate line. The grep searches for lines starting with the # symbol. Finally sort -u sorts the list and returns the uniques.
This command takes about 15 seconds to run and did the job perfectly for me.
I am basically looking for a way to do this
list=$(command)
while read -r arg
do
...
done <<< "$list"
Using sh intead of bash. The code as it is doesn't run because of the last line:
syntax error: unexpected redirection
Any fixes?
Edit: I need to edit variables and access them outside the loop, so using | is not acceptable (as it creates a sub-shell with independent scope)
Edit 2: This question is NOT similar to Why does my Bash counter reset after while loop as I am not using | (as I just noticed in the last edit). I am asking for another way of achiving it. (The answers to the linked question only explain why the problem happens but do not provide any solutions that work with sh (no bash).
There's no purely syntactic way to do this in POSIX sh. You'll need to use either a temporary file for the output of the command, or a named pipe.
mkfifo output
command > output &
while read -r arg; do
...
done < output
rm output
Any reason you can't do this? Should work .. unless you are assigning any variables inside the loop that you want visible when it's done.
command |
while read -r arg
do
...
done
I'm trying to write a simple Autotool package that just packages a single script. This might seem like overkill, but the script is to be added into the build-system for an embedded system and the build-system is designed to play nicely with Autotools.
I have a shell-script called wifi_query.sh. To package this I've followed the following steps:
Created Makefile.am which contains the following -
bin_SCRIPTS = wifi_query.sh
CLEANFILES = $(bin_SCRIPTS)
I also created wifi_query.sh.in which contains the line exec wifi_query.sh. I'm not sure I understand the purpose of the .in file.
I then run autoscan.
Then I run:
sed -e 's/FULL-PACKAGE-NAME/wifi_query/' \
-e 's/VERSION/1/' \
-e 's|BUG-REPORT-ADDRESS|/dev/null|' \
-e '10i\
AM_INIT_AUTOMAKE' \
< configure.scan > configure.ac
Run touch NEWS README AUTHORS ChangeLog.
Run autoreconf -iv
./configure
make distcheck
When I run make distcheck I get an error saying: "* No rule to make target 'wifi_query.sh', needed by 'all-am'. Stop.".
I don't understand this error, if anyone could give me any pointers that would be good. My suspicion is that the error may be due to wifi_query.sh.in, but I have very limited autotools experience.
It seems I needed to replace the line bin_SCRIPTS = wifi_query.sh with dist_bin_SCRIPTS = wifi_query.sh in Makefile.am. Having done that everything seems to work.