Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Early return on access-sequence resolution fails #1787

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions tools/projmgr/src/ProjMgrWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3395,8 +3395,12 @@ bool ProjMgrWorker::AddFile(const FileNode& src, vector<FileNode>& dst, ContextI
FileNode srcNode = src;

// Replace sequences and/or adjust file relative paths
ProcessSequenceRelative(context, srcNode.file, root);
ProcessSequencesRelatives(context, srcNode.build, root);
if (!ProcessSequenceRelative(context, srcNode.file, root)) {
return false;
}
if (!ProcessSequencesRelatives(context, srcNode.build, root)) {
return false;
}
UpdateMisc(srcNode.build.misc, context.toolchain.name);

// Set file category
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### CMSIS Project Description ###

project:
components:
- component: CORE
groups:
- group: CMSE
files:
- file: $cmse-lib(test-access-sequences-invalid)$
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### CMSIS Project Description ###
solution:

target-types:
- type: CM0
device: RteTest_ARMCM0
misc:
- for-compiler: AC6
C-CPP: [-C-CPP-$Dname$]
define:
- DEF-CM0-$Dname$-$Bname$
add-path:
- ./path/CM0/$Dname$

build-types:
- type: Debug
compiler: AC6
misc:
- C-CPP:
- -O1
- -g

projects:
- project: ./test-not_exisitng-access-sequences1.cproject.yml

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### CMSIS Project Description ###

project:
components:
- component: CORE
groups:
- group: CMSE
files:
- file: main.c
define:
- DEF2-PROJ1-$elf(test-access-sequences5+CM3)$
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### CMSIS Project Description ###
solution:

target-types:
- type: CM0
device: RteTest_ARMCM0
misc:
- for-compiler: AC6
C-CPP: [-C-CPP-$Dname$]
define:
- DEF-CM0-$Dname$-$Bname$
add-path:
- ./path/CM0/$Dname$

build-types:
- type: Debug
compiler: AC6
misc:
- C-CPP:
- -O1
- -g

projects:
- project: ./test-not_exisitng-access-sequences2.cproject.yml

32 changes: 32 additions & 0 deletions tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,38 @@ TEST_F(ProjMgrUnitTests, AccessSequences2) {
testinput_folder + "/TestAccessSequences/ref/test-access-sequences2.cbuild-idx.yml");
}

TEST_F(ProjMgrUnitTests, InvalidRefAccessSequences1) {
char* argv[7];
StdStreamRedirect streamRedirect;
// convert --solution solution.yml
const string& csolution = testinput_folder + "/TestAccessSequences/test-not_exisitng-access-sequences1.csolution.yml";
argv[1] = (char*)"convert";
argv[2] = (char*)"--solution";
argv[3] = (char*)csolution.c_str();
argv[4] = (char*)"-o";
argv[5] = (char*)testoutput_folder.c_str();
argv[6] = (char*)"--cbuildgen";
EXPECT_EQ(1, RunProjMgr(7, argv, m_envp));
const string& errStr = streamRedirect.GetErrorString();
EXPECT_TRUE(errStr.find("context 'test-access-sequences-invalid' referenced by access sequence 'cmse-lib' does not exist or is not selected") != string::npos);
}

TEST_F(ProjMgrUnitTests, InvalidRefAccessSequences2) {
char* argv[7];
StdStreamRedirect streamRedirect;
// convert --solution solution.yml
const string& csolution = testinput_folder + "/TestAccessSequences/test-not_exisitng-access-sequences2.csolution.yml";
argv[1] = (char*)"convert";
argv[2] = (char*)"--solution";
argv[3] = (char*)csolution.c_str();
argv[4] = (char*)"-o";
argv[5] = (char*)testoutput_folder.c_str();
argv[6] = (char*)"--cbuildgen";
EXPECT_EQ(1, RunProjMgr(7, argv, m_envp));
const string& errStr = streamRedirect.GetErrorString();
EXPECT_TRUE(errStr.find("context 'test-access-sequences5+CM3' referenced by access sequence 'elf' does not exist or is not selected") != string::npos);
}

TEST_F(ProjMgrUnitTests, PackAccessSequences) {
char* argv[6];
StdStreamRedirect streamRedirect;
Expand Down
Loading