Skip to content

ASIF: Add blockSize detection and unit tests on macOS#64

Merged
AkihiroSuda merged 1 commit intolima-vm:masterfrom
norio-nomura:asif-detect-blocksize
Nov 18, 2025
Merged

ASIF: Add blockSize detection and unit tests on macOS#64
AkihiroSuda merged 1 commit intolima-vm:masterfrom
norio-nomura:asif-detect-blocksize

Conversation

@norio-nomura
Copy link
Contributor

ref: https://github.com/fox-it/dissect.hypervisor/blob/0c8976613a369923e69022304b2f0ed587e997e2/dissect/hypervisor/disk/c_asif.py#L19

Since ASIF file format information does not exist officially, we should test the parsed properties in unit test.

Fixes #62


func TestOpenASIF(t *testing.T) {
// Check macOS version
if productVersion, err := exec.CommandContext(context.Background(), "sw_vers", "--productVersion").Output(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

t.Context should be used.
Same for other commands too, and please squash the commits

Copy link
Contributor Author

Choose a reason for hiding this comment

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

t.Context() requires Go 1.24+.

Copy link
Member

Choose a reason for hiding this comment

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

We can drop the support for Go 1.23 as it has reached EOL
https://endoflife.date/go

@norio-nomura norio-nomura force-pushed the asif-detect-blocksize branch 3 times, most recently from befc316 to 3556092 Compare November 18, 2025 05:57
ref: https://github.com/fox-it/dissect.hypervisor/blob/0c8976613a369923e69022304b2f0ed587e997e2/dissect/hypervisor/disk/c_asif.py#L19

Since ASIF file format information does not exist officially, we should test the parsed properties in unit test.

Signed-off-by: Norio Nomura <norio.nomura@gmail.com>

Apply reviews

- rename to `image/asif/asif_darwin_test.go`
- remove redundant check
- rename to `TestOpenASIF()`
- use `exe.CommandContext()`
- Bumpt to Go 1.24

Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit bdeee93 into lima-vm:master Nov 18, 2025
3 checks passed
@norio-nomura norio-nomura deleted the asif-detect-blocksize branch November 18, 2025 06:23
@norio-nomura
Copy link
Contributor Author

Thanks! 🙏🏻

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.

ASIF: support non-512 sector size

2 participants