You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[#72] Add find-refs test coverage and fix its database/null-ref bugs (#79)
* Introduce second UnityProject
Rename UnityFileSystemTestData and introduce a LeadingEdge project for testing Content Directory builds and other newer features that require Unity >=6.6.
Add AGENTS.md explaining the relationship between these projects and the referenced files checked in to TestCommon
* Dump command tested with core numeric field types and other serialization primitives
* [#72] Fix find-refs database open and null-ref crashes, add test coverage
find-refs had no automated tests and two bugs that broke it against any
current analyze database:
- Issue #72: the database was opened with a hand-written connection string
using the legacy System.Data.SQLite "Version=3" keyword, which
Microsoft.Data.Sqlite rejects. Build the connection string with
SqliteConnectionStringBuilder instead (matching SQLiteWriter). Fixed the
same broken string in ExpectedDataGenerator.
- A ScriptableObject is a MonoBehaviour whose m_GameObject PPtr is 0, so its
game_object column is a non-null id matching no row; the game_object/script
subqueries then return NULL and GetString threw. Null-check those reads.
Also add a --stdout option to find-refs (mutually exclusive with -o), mirroring
dump, and update command-find-refs.md.
Add FindRefsTests covering both bugs, name/type lookup and disambiguation,
object-id lookup, --find-all, missing objects, empty refs table, the
--stdout/-o validator, and direct refs-table queries. Tests run against the
LeadingEdge AssetBundle reference build.
Copy file name to clipboardExpand all lines: AGENTS.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -174,4 +174,6 @@ To use a specific Unity version's library:
174
174
175
175
* TestCommon/Data contains small reference files extracted from Unity builds (player and AssetBundles). These are used by the automated tests and also useful for manual testing.
176
176
177
-
* UnityFileSystemTestData is a Unity project that generates test data for the test suites.
177
+
* UnityProjects contains two Unity projects that generate test data for the test suites:
178
+
*`Baseline` - tracks stable, broadly-used Unity versions and is upgraded only when necessary. Most UnityDataTools users inspect output from these versions. Its `TypeIdRegistryGenerator` regenerates `UnityFileSystem/TypeIdRegistry.cs`.
179
+
*`LeadingEdge` - tracks the newest Unity version (currently the 6.6 beta) and is updated proactively so newer build features (Content Directory builds, serialized dictionaries, etc.) can be tested.
Copy file name to clipboardExpand all lines: Documentation/command-find-refs.md
+13-5Lines changed: 13 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
# find-refs Command
2
2
3
-
> ⚠️ **Experimental:** This command may not work as expected in all cases.
4
-
5
3
The `find-refs` command traces reference chains leading to specific objects. Use it to understand why an asset was included (and potentially duplicated) in a build.
6
4
5
+
It walks *up* the reference graph from the target object and **stops at the first asset it reaches**. The reported chains therefore end at the immediate containing asset, not at the ultimate root that transitively depends on the target. For example, if `RootAsset` references `LeafAsset` which references a texture, searching for the texture reports the chain ending at `LeafAsset`; to see that `RootAsset` pulls it in, search for `LeafAsset` instead.
m_GetRefsCommand.CommandText=@"SELECT object, property_path, EXISTS (SELECT * FROM assets a WHERE a.object = r.object) FROM refs r WHERE referenced_object = @id";
@@ -181,7 +191,11 @@ FROM object_view o
181
191
}
182
192
}
183
193
184
-
m_Writer.Close();
194
+
// Don't close Console.Out when writing to stdout; just flush it.
AssetBundle build output used by the UnityDataTools test suites, kept in a subfolder per Unity version (`2019.4.0f1` through `2023.1.0a16`). Each holds the `assetbundle` and `scenes` bundles built from the project's assets; some versions also include additional fixtures used by specific tests.
4
+
5
+
Generated by the `UnityProjects/Baseline` project - run **Tools > Generate AssetBundles** there (built for StandaloneOSX and copied here under the Unity version). See that project's `AGENTS.md` for the assets that go into the bundles.
The checked-in build output of the `UnityProjects/LeadingEdge` project, for use in automated and ad hoc tests. See that project's `AGENTS.md` for the test scenarios and how the assets are set up.
4
+
5
+
The LeadingEdge build scripts regenerate this folder directly, so to update it, rebuild in that project and check in the results.
6
+
7
+
## Layout
8
+
9
+
*`AssetBundles/` - the AssetBundle build: one bundle per asset (named after the asset) plus the `AssetBundles` manifest bundle.
10
+
*`ContentDirectory/` - the Content Directory build: content (`.cf`) files, `.resource` files and the build manifest.
11
+
*`BuildReport-AssetBundles/LastBuild.buildreport` - the AssetBundle build report.
12
+
*`BuildReport-ContentDirectory/` - the Content Directory build report folder, including `ContentLayout.json`.
0 commit comments