forked from snabbco/snabb
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check-generated-code.nix: Check if in-tree VM code is stale
- Loading branch information
Showing
2 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Check that generated sources match the repo version. | ||
{ pkgs, raptorjit }: | ||
with pkgs; with lib; | ||
|
||
# Generated files that are kept in tree. | ||
let generatedFiles = | ||
"lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h host/buildvm_arch.h"; | ||
in | ||
|
||
overrideDerivation raptorjit (as: | ||
{ | ||
preBuild = '' | ||
pushd src | ||
mkdir old | ||
for f in ${generatedFiles}; do | ||
cp $f old/ | ||
done | ||
popd | ||
'' + as.preBuild; | ||
checkPhase = '' | ||
pushd src | ||
mkdir new | ||
for f in ${generatedFiles}; do | ||
cp $f new/ | ||
done | ||
echo "Checking that in-tree generated VM code is up-to-date..." | ||
diff -u old new || (echo "Error: Stale generated code"; exit 1) | ||
popd | ||
''; | ||
doCheck = true; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters