@@ -59,21 +59,24 @@ describe('CbuildRunReader', () => {
5959 pname : undefined ,
6060 expectedSvdPaths : [
6161 '/my/pack/root/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_Core0.svd' ,
62- '/my/pack/root/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_Core1.svd'
62+ '/my/pack/root/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_Core1.svd' ,
63+ '/my/pack/root/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_generic.svd' ,
6364 ]
6465 } ,
6566 {
6667 info : 'Core0' ,
6768 pname : 'Core0' ,
6869 expectedSvdPaths : [
6970 '/my/pack/root/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_Core0.svd' ,
71+ '/my/pack/root/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_generic.svd' ,
7072 ]
7173 } ,
7274 {
7375 info : 'Core1' ,
7476 pname : 'Core1' ,
7577 expectedSvdPaths : [
76- '/my/pack/root/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_Core1.svd'
78+ '/my/pack/root/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_Core1.svd' ,
79+ '/my/pack/root/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_generic.svd' ,
7780 ]
7881 } ,
7982 ] ) ( 'returns SVD file path ($info)' , async ( { pname, expectedSvdPaths } ) => {
@@ -90,5 +93,43 @@ describe('CbuildRunReader', () => {
9093 const svdFilePaths = cbuildRunReader . getSvdFilePaths ( '/my/pack/root' ) ;
9194 expect ( svdFilePaths . length ) . toEqual ( 0 ) ;
9295 } ) ;
96+
97+ it ( 'returns empty SCVD file path list when nothing is parsed' , async ( ) => {
98+ const scvdFilePaths = cbuildRunReader . getScvdFilePaths ( '/my/pack/root' ) ;
99+ expect ( scvdFilePaths . length ) . toEqual ( 0 ) ;
100+ } ) ;
101+
102+ it ( 'returns processor names from debug topology' , async ( ) => {
103+ await cbuildRunReader . parse ( TEST_CBUILD_RUN_FILE ) ;
104+ const pnames = cbuildRunReader . getPnames ( ) ;
105+ expect ( pnames ) . toEqual ( [ 'Core0' , 'Core1' ] ) ;
106+ } ) ;
107+
108+ it ( 'includes descriptors without pname when filtering by pname (SVD)' , async ( ) => {
109+ await cbuildRunReader . parse ( TEST_CBUILD_RUN_FILE ) ;
110+ const cbuildRun = ( cbuildRunReader as unknown as { cbuildRun ?: { [ 'system-descriptions' ] ?: Array < { file : string ; type : string ; pname ?: string } > } } ) . cbuildRun ;
111+ const systemDescriptions = cbuildRun ?. [ 'system-descriptions' ] ;
112+ expect ( systemDescriptions ) . toBeDefined ( ) ;
113+ const svdPaths = cbuildRunReader . getSvdFilePaths ( '' , 'Core1' ) ;
114+
115+ expect ( svdPaths ) . toEqual ( [
116+ '${CMSIS_PACK_ROOT}/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_Core1.svd' ,
117+ '${CMSIS_PACK_ROOT}/MyVendor/MyDevice/1.0.0/Debug/SVD/MyDevice_generic.svd'
118+
119+ ] ) ;
120+ } ) ;
121+
122+ it ( 'includes descriptors without pname when filtering by pname (SCVD)' , async ( ) => {
123+ await cbuildRunReader . parse ( TEST_CBUILD_RUN_FILE ) ;
124+ const cbuildRun = ( cbuildRunReader as unknown as { cbuildRun ?: { [ 'system-descriptions' ] ?: Array < { file : string ; type : string ; pname ?: string } > } } ) . cbuildRun ;
125+ const systemDescriptions = cbuildRun ?. [ 'system-descriptions' ] ?? [ ] ;
126+ expect ( systemDescriptions ) . toBeDefined ( ) ;
127+ const scvdPaths = cbuildRunReader . getScvdFilePaths ( '' , 'Core1' ) ;
128+
129+ expect ( scvdPaths ) . toEqual ( [
130+ '${CMSIS_PACK_ROOT}/MyVendor/MyDevice/1.0.0/Debug/SCVD/MySoftware_component.scvd' ,
131+ '${CMSIS_PACK_ROOT}/MyVendor/MyDevice/1.0.0/Debug/SCVD/Core1.scvd' ,
132+ ] ) ;
133+ } ) ;
93134 } ) ;
94135} ) ;
0 commit comments