Mole
Mole copied to clipboard
Avoid unnecessary sudo in install, use safe test cleanup, and relax perf threshold
Motivation
- Prevent installing as root into writable temporary prefixes by ensuring
needs_sudochecks the parent directory whenINSTALL_DIRdoes not exist. - Make test cleanup safer by using existing removal utilities instead of raw
rm -rf. - Reduce fragility of the
bytes_to_humanperformance test by allowing a configurable threshold for timing variability.
Description
- Update
needs_sudoininstall.shto return writable checks forINSTALL_DIRwhen it exists and otherwise check the parent directory. - Source
lib/core/file_ops.shinscripts/test.shand replace the rawrm -rf /tmp/mole-testwithsafe_remove "/tmp/mole-test" true. - Change
tests/performance.batsto use a configurable limitMOLE_PERF_BYTES_TO_HUMAN_LIMIT_MSwith a default of4000ms instead of a hard-coded2000ms.
Testing
- No automated tests were executed as part of this change.