Emberveil source

tests/PetCacheUpdateCheck.java

import java.nio.file.*;
public class PetCacheUpdateCheck {
 public static void main(String[] args)throws Exception {
  Path root=Paths.get(args[0]).toAbsolutePath();Files.createDirectories(root);Path sentinel=root.resolve("keep.txt");Files.write(sentinel,"existing cache remains untouched".getBytes("UTF-8"));
  Path prepared=PetCacheUpdate.prepare(root.toString());if(prepared.equals(root)||!PetCacheUpdate.complete(prepared)||!Files.exists(sentinel))throw new AssertionError("safe cache preparation");
  if(!PetCacheUpdate.prepare(prepared.toString()).equals(prepared))throw new AssertionError("idempotent startup");
  System.out.println("PASS real public cache download, six SHA256/size checks, existing-cache isolation and idempotent startup");
 }
}