Skip to content

Added more tests + code cleanup#35

Merged
sanbee merged 16 commits into
masterfrom
template_refact
Apr 22, 2026
Merged

Added more tests + code cleanup#35
sanbee merged 16 commits into
masterfrom
template_refact

Conversation

@sanbee
Copy link
Copy Markdown
Owner

@sanbee sanbee commented Apr 16, 2026

  1. Bug fix in shell.l that prevents seg. fault in readline() if the env. variable TERM is not defined.
  2. clgetValp.{cc,h} is API-level header-only call templated for the parameters passed.
  3. Added clExit() exception to use instead of calling exit().
  4. Added workflow_dispatch: in parafeed_CI.yaml to allow manual trigger for CI runner.
  5. Added many more test to the test suite which now covers a large fraction of functionality that was earlier tested manually via running tstcpp by-hand.
  6. General code cleanup/code refactoring.

sanbee and others added 13 commits April 3, 2026 09:10
…ode.

                  It is not compiled into the libraries.
clgetSVal.cc: Not required any more
clgetFullVal.cc: Includes clgetValp.h
ParseCmdLine.cc: Changes to use clgetValp() calls.
code/CMakeLists.txt: Stop complining clget{S,NS}Val.o
                     Install clgetValp.cc also.
test_parafeed_interactive.cpp: Added test for clgetFullVal().
test_parafeed_noninteractive.cpp: Added an interactive test that was
                                  earlier failing ('cause not all
                                  library state variables were reset).
Testing if adding on: workflow_dispatch enables triggering runners by-hand (e.g. for testing branches other than `master` and `main`.
     Removed trailing whitespaces, coverted code formatting to be
     consistent with the rest of the code (which is GNU-style).

     Removed calls to clCleanUp() in the test code (it is called
     in ~ParafeedTest()).
{ParseCmdLine,callbacks,support}.cc: Replaced exit() with throw(clExit()).
tstcpp.cc: Also catch clExit().
_noninteractive.cpp: Changes in names of global functions
_interactive.cpp: Added a test for complimentary load
testing.txt: Marked tests that are now implemented as DONE.
                  Test for dbg-class keys visibilit.
		  Test for hidden keys.

_noninteractive.cpp:  General cleanup + tests for dbg-class keys.
@sanbee sanbee requested a review from agawatw April 16, 2026 20:13
Comment thread code/test/unittest/ParafeedTest.h Outdated
Comment thread code/test/unittest/test_parafeed_noninteractive.cpp Outdated
ParafeedTest.h: Removed the writeDefFile parameters from all functions
                and where they are called.
test_parafeed_*: Changes due to change in ParafeedTest API.
                 Fixed DefModeWithDefFileError test.
		 Added more information in the [Info] string.
Comment thread code/clgetValp.cc Outdated
int clgetNSValp(const std::string& Name, std::vector<std::string>& val, int& n) {return clgetValp(Name,val,n);}
int clgetNSValp(const std::string& Name, std::vector<std::string>& val, int& n, SMap &smap) {return clgetValp(Name,val,n,smap);}
int clgetNSValp(const std::string& Name, std::vector<std::string>& val, int& n, const SMap smap) {return clgetValp(Name,val,n,smap);}
inline int clgetSVal(const char *Name, char *val, int *n) {return clgetValp(std::string(Name), *val, *n);}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is a newly added function, but it seems to call the the template function clgetValp wrong. The *val in clgetValp(std::string(Name), *val, *n); is a single character, not a buffer that is writable, so when users write

char buf[10]; clgetSVal(..., buf, &n);

and expect a full string written into buf, only buf[0] is modified.
It should call clgetValp(std::string(Name), val, *n);, instead.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out that making the clgetSVal() interface and all its variables work require more work in a number of files. So I have currently disabled this interface (i.e. using it will lead to compile-time error). The solution, for now, is to use the clgetSValp() interface that show for std::string value.

Code that would test the clgetSVal() interface in ParafeedTest.h is left as a comment, which we will enable as part of a separate PR to get clgetSVal() and variants work.

and will be included in a separate PR.

clgetValp.cc: Disabled forward decl of type
              clgetSVal(const char *Name, char *val, int *n).

clgerFullVal.cc: Translated clgetSVal() to clgetSValp() (the C++
                 interface).

ParafeedTest.h: Left commented code to test the clgetSVal() interface,
                which currently leads to compile-time error.
@agawatw
Copy link
Copy Markdown
Collaborator

agawatw commented Apr 22, 2026

I reviewed all of the code changes in this pull request. It looks good now and can be merged.

@sanbee sanbee merged commit 3948bc2 into master Apr 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants