Skip to content

Commit 858f910

Browse files
authored
Merge pull request #284 from CBenghi/development
Updated audit tool and fixed #111
2 parents 08a4e25 + cf35548 commit 858f910

9 files changed

+55
-15
lines changed

.nuke/build.schema.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@
7777
"AuditDocTestCases",
7878
"CleanSchemaProject",
7979
"CompileSchemaProject",
80-
"CreateTestCases"
80+
"CreateTestCases",
81+
"TestAccurateInvalid"
8182
]
8283
}
8384
},
@@ -92,7 +93,8 @@
9293
"AuditDocTestCases",
9394
"CleanSchemaProject",
9495
"CompileSchemaProject",
95-
"CreateTestCases"
96+
"CreateTestCases",
97+
"TestAccurateInvalid"
9698
]
9799
}
98100
},

Documentation/testcases/partof/fail-the_container_predefined_type_must_match_exactly_1_2.ifc

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FILE_SCHEMA(('IFC4'));
66
ENDSEC;
77
DATA;
88
#1=IFCELEMENTASSEMBLY('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,$,$,$,$,$,$);
9-
#2=IFCSPACE('0eA6m4fELI9QBIhP3wiLAp',$,$,$,'BURROW',$,$,$,$,$,$);
9+
#2=IFCSPACE('0eA6m4fELI9QBIhP3wiLAp',$,$,$,'BURROW',$,$,$,$,.USERDEFINED.,$,$);
1010
#3=IFCRELCONTAINEDINSPATIALSTRUCTURE('05rScmOVzMoQXOfbYdtLYj',$,$,$,(#1),#2);
1111
ENDSEC;
1212
END-ISO-10303-21;

Documentation/testcases/partof/fail-the_nest_predefined_type_must_match_exactly_1_2.ifc

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FILE_NAME('','2022-10-07T13:48:44',(),(),'IfcOpenShell v0.7.0-dc67287d','IfcOpen
55
FILE_SCHEMA(('IFC4'));
66
ENDSEC;
77
DATA;
8-
#1=IFCFURNITURE('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,'WATERBOTTLE',$,$,$,$);
8+
#1=IFCFURNITURE('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,'WATERBOTTLE',$,$,$,.USERDEFINED.);
99
#2=IFCDISCRETEACCESSORY('0eA6m4fELI9QBIhP3wiLAp',$,$,$,$,$,$,$,$);
1010
#3=IFCRELNESTS('05rScmOVzMoQXOfbYdtLYj',$,$,$,#1,(#2));
1111
ENDSEC;

Documentation/testcases/partof/invalid-a_group_predefined_type_must_match_exactly_2_2.ifc

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FILE_SCHEMA(('IFC4'));
66
ENDSEC;
77
DATA;
88
#1=IFCELEMENTASSEMBLY('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,$,$,$,$,$,$);
9-
#2=IFCINVENTORY('0eA6m4fELI9QBIhP3wiLAp',$,$,$,'BUNNY',$,$,$,$,$,$);
9+
#2=IFCINVENTORY('0eA6m4fELI9QBIhP3wiLAp',$,$,$,'BUNNY',.USERDEFINED.,$,$,$,$,$);
1010
#3=IFCRELASSIGNSTOGROUP('05rScmOVzMoQXOfbYdtLYj',$,$,$,(#1),$,#2);
1111
ENDSEC;
1212
END-ISO-10303-21;

Documentation/testcases/partof/pass-a_group_predefined_type_must_match_exactly_2_2.ifc

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FILE_SCHEMA(('IFC4'));
66
ENDSEC;
77
DATA;
88
#1=IFCELEMENTASSEMBLY('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,$,$,$,$,$,$);
9-
#2=IFCINVENTORY('0eA6m4fELI9QBIhP3wiLAp',$,$,$,'BUNNY',$,$,$,$,$,$);
9+
#2=IFCINVENTORY('0eA6m4fELI9QBIhP3wiLAp',$,$,$,'BUNNY',.USERDEFINED.,$,$,$,$,$);
1010
#3=IFCRELASSIGNSTOGROUP('05rScmOVzMoQXOfbYdtLYj',$,$,$,(#1),$,#2);
1111
ENDSEC;
1212
END-ISO-10303-21;

Documentation/testcases/partof/pass-the_container_predefined_type_must_match_exactly_2_2.ifc

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FILE_SCHEMA(('IFC4'));
66
ENDSEC;
77
DATA;
88
#1=IFCELEMENTASSEMBLY('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,$,$,$,$,$,$);
9-
#2=IFCSPACE('0eA6m4fELI9QBIhP3wiLAp',$,$,$,'BURROW',$,$,$,$,$,$);
9+
#2=IFCSPACE('0eA6m4fELI9QBIhP3wiLAp',$,$,$,'BURROW',$,$,$,$,.USERDEFINED.,$);
1010
#3=IFCRELCONTAINEDINSPATIALSTRUCTURE('05rScmOVzMoQXOfbYdtLYj',$,$,$,(#1),#2);
1111
ENDSEC;
1212
END-ISO-10303-21;

Documentation/testcases/partof/pass-the_nest_predefined_type_must_match_exactly_2_2.ifc

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FILE_NAME('','2022-10-07T13:48:44',(),(),'IfcOpenShell v0.7.0-dc67287d','IfcOpen
55
FILE_SCHEMA(('IFC4'));
66
ENDSEC;
77
DATA;
8-
#1=IFCFURNITURE('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,'WATERBOTTLE',$,$,$,$);
8+
#1=IFCFURNITURE('1hqIFTRjfV6AWq_bMtnZwI',$,$,$,'WATERBOTTLE',$,$,$,.USERDEFINED.);
99
#2=IFCDISCRETEACCESSORY('0eA6m4fELI9QBIhP3wiLAp',$,$,$,$,$,$,$,$);
1010
#3=IFCRELNESTS('05rScmOVzMoQXOfbYdtLYj',$,$,$,#1,(#2));
1111
ENDSEC;

build/Build.cs

+44-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class Build : NukeBuild
1111
{
1212
public static int Main() => Execute<Build>(x => x.AuditAllIdsFiles);
13-
13+
1414
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
1515
private readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
1616

@@ -184,15 +184,53 @@ class Build : NukeBuild
184184
var inputFolder = RootDirectory / "Documentation" / "testcases";
185185
var arguments = $"audit \"{inputFolder}\" --omitContentAuditPattern \"[\\\\|/]invalid-\" -x \"{schemaFile}\"";
186186
IdsTool(arguments, workingDirectory: IdsToolPath);
187-
});
187+
});
188188

189-
/// <summary>
190-
/// Perform all quality assurance of published IDS files; this is the one invoked by default
191-
/// </summary>
192-
Target AuditAllIdsFiles => _ => _
189+
/// <summary>
190+
/// Audits the validity of Documentation/testcases folder in the repository, using ids-tool.
191+
/// The tool is deployed by the annotated <see cref="IdsTool"/>.
192+
/// The schema is loaded from the repository to ensure internal coherence.
193+
/// </summary>
194+
Target TestAccurateInvalid => _ => _
195+
.AssuredAfterFailure()
196+
.Executes(() =>
197+
{
198+
// we are omitting tests on the content of the Documentation/testcases folder,
199+
// because they include IDSs that intentionally contain errors
200+
//
201+
// todo: once stable, this could be improved to omit contents based on failure patter name
202+
// todo: once stable, constrained on expected auditing failures on the "fail-" cases should be added
203+
var schemaFile = RootDirectory / "Development" / "ids.xsd";
204+
var inputFolder = RootDirectory / "Documentation" / "testcases";
205+
206+
DirectoryInfo d = new DirectoryInfo(inputFolder);
207+
foreach (var invalidFile in d.GetFiles("invalid-*.ids", SearchOption.AllDirectories))
208+
{
209+
Console.WriteLine(invalidFile.FullName);
210+
var arguments = $"audit \"{invalidFile}\" -x \"{schemaFile}\"";
211+
try
212+
{
213+
var t = IdsTool(arguments, workingDirectory: IdsToolPath);
214+
}
215+
catch (ProcessException ex)
216+
{
217+
if (ex.ExitCode != 16)
218+
throw new Exception("Unexpected exit code");
219+
220+
}
221+
}
222+
223+
224+
});
225+
226+
/// <summary>
227+
/// Perform all quality assurance of published IDS files; this is the one invoked by default
228+
/// </summary>
229+
Target AuditAllIdsFiles => _ => _
193230
.AssuredAfterFailure()
194231
.DependsOn(AuditDocTestCases)
195232
.DependsOn(AuditDevelopment)
233+
.DependsOn(TestAccurateInvalid)
196234
.Executes(() =>
197235
{
198236
Console.WriteLine("This is an utility target that launches all available IDS auditing targets.");

build/_build.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Nuke.Common" Version="6.3.0" />
16-
<PackageReference Include="ids-tool.CommandLine" Version="1.0.72" />
16+
<PackageReference Include="ids-tool.CommandLine" Version="1.0.73" />
1717
<PackageDownload Include="dotnet-xscgen" Version="[2.1.1094]" />
1818
</ItemGroup>
1919

0 commit comments

Comments
 (0)