Skip to content

Conversation

@fhost
Copy link

@fhost fhost commented Nov 24, 2025

New: Add a small fscrypt test into the base provider, in its own category.

Description

The new fscrypt test generates an ext4 disk image, mount it and setup fscrypt.
Then it creates a file in the disk image mountpoint, locks it and verifies that the file is not accessible anymore. Finally, it unlocks it and check that the file is accessible and its content is correct.

Tests

checkbox-cli, select automated fscrypt test, run the test plan. Tested on my laptop and on my project device (qualcomm arm64 device). Testing with fscrypt already setup and not setup.

@fhost fhost force-pushed the fhost/fscrypt branch 2 times, most recently from 3334c41 to bc7d5f2 Compare November 24, 2025 17:27
@fhost fhost changed the title providers/base: add fscrypt test new: providers/base: add fscrypt test Nov 24, 2025
@fhost fhost changed the title new: providers/base: add fscrypt test providers/base: add fscrypt test (New) Nov 24, 2025
@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.81%. Comparing base (a941f1f) to head (a585b2c).
⚠️ Report is 26 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2215      +/-   ##
==========================================
+ Coverage   53.70%   53.81%   +0.11%     
==========================================
  Files         401      402       +1     
  Lines       43144    43258     +114     
  Branches     7996     8022      +26     
==========================================
+ Hits        23170    23281     +111     
- Misses      19161    19162       +1     
- Partials      813      815       +2     
Flag Coverage Δ
provider-base 31.36% <100.00%> (+0.45%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fhost fhost force-pushed the fhost/fscrypt branch 5 times, most recently from c4de44f to cef64d9 Compare November 25, 2025 14:57
Copy link

@hawesy-can hawesy-can left a comment

Choose a reason for hiding this comment

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

LGTM, but I'm not an expert in this area.

text=True,
)
found = False
pattern = re.compile(rf"^{re.escape(str(mnt))}.*supported *Yes$")

Choose a reason for hiding this comment

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

Ignoring the CI run which failed at this line with an invalid syntax error.

Copy link
Author

@fhost fhost Dec 11, 2025

Choose a reason for hiding this comment

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

I don't understand what's wrong there. I do not reproduce on my side.

Copy link
Author

Choose a reason for hiding this comment

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

fstring does not exsit in python 3.5!

@fhost fhost force-pushed the fhost/fscrypt branch 2 times, most recently from 4aba6b4 to 9a34ccc Compare December 11, 2025 10:01
@fhost fhost requested a review from hawesy-can December 11, 2025 15:40
@fhost fhost force-pushed the fhost/fscrypt branch 2 times, most recently from 3de25d3 to 4e57c8d Compare January 9, 2026 14:35
Copy link
Collaborator

@pieqq pieqq left a comment

Choose a reason for hiding this comment

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

Sorry for the long silence. I've added a few comments, see if they make sense.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

The purpose of this scrupt is to make a small fscrupt test on a generated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The purpose of this scrupt is to make a small fscrupt test on a generated
The purpose of this script is to make a small fscrypt test on a generated

)
found = False
pattern = re.compile(
"^{}.*supported *Yes$".format(re.escape(str(mnt)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"^{}.*supported *Yes$".format(re.escape(str(mnt)))
"^{}.*supported\s*Yes$".format(re.escape(str(mnt)))

I'm not sure if fscrypt uses tabs as well in its output, it's probably better to catch any kind of space there.

"--quiet",
"--source=raw_key",
"--name=test_key",
f"--key={str(key_file)}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

f-strings are not supported in python 3.5 which we still support, so please use .format instead.


with test_file.open("r") as f:
content = f.read().strip()
if content != test_content:
Copy link
Collaborator

Choose a reason for hiding this comment

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

For easier debugging or review, please print the expected content and the actual content before raising SystemExit.

print("File is accessible and content is correct after unlock")
finally:
subprocess.check_call(["umount", str(mnt)])
if not fscrypt_setup and fscrypt_config.exists():
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure to understand this line, given that at the top of the script, you set

fscrypt_setup = fscrypt_config.exists()

What's the expectation here?

Copy link
Author

Choose a reason for hiding this comment

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

Depending if there was an error during the test, the configuration might not have been created. I could just remove the test (the exists() one) and do a "rm -f" if you prefer.

@fhost fhost force-pushed the fhost/fscrypt branch 4 times, most recently from d8b9f0f to 270f461 Compare January 9, 2026 15:17
@fhost fhost requested a review from pieqq January 9, 2026 15:35
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.

3 participants