Skip to content

Commit 61a95e2

Browse files
committed
fix uica PATHs
1 parent 9234aff commit 61a95e2

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

CryptOpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ INSTALLDIR="$(dirname "${0}")"
2626
cd "${INSTALLDIR}"
2727

2828
#run
29-
PATH="$(realpath ./bins/node/bin):${PATH}" \
29+
PATH="$(realpath ./bins/uiCA):$(realpath ./bins/node/bin):${PATH}" \
3030
/usr/bin/env node \
3131
"./dist/CryptOpt.js" "${@}"

src/optimizer/measure.class.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,14 @@ export default class MeasureUtil {
164164

165165
// call uiCA
166166
const uiCAArgs = ["-TPonly", "-arch", this.timer, "-raw", join(tmpDir, "binary.bin")];
167-
const r = spawnSync("./bins/uiCA/uiCA.py", uiCAArgs);
167+
const r = spawnSync("uiCA.py", uiCAArgs);
168168
if (r.status != 0) {
169169
throw new Error(
170170
`uiCA command failed. STDERR:${r.stderr}, STDOUT: ${r.stdout}. May be because ./uiCA is not in the cwd.`,
171171
);
172172
}
173-
const tpout = spawnSync("./uiCA", uiCAArgs).stdout.toString();
173+
// "uiCA.py" is in PATH, see "./CryptOpt"-wrapper start script
174+
const tpout = spawnSync("uiCA.py", uiCAArgs).stdout.toString();
174175

175176
const tp = Number(tpout);
176177
if (isNaN(tp)) {

test/optimiser/measure.class.ts

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ describe("lengthMeasure", () => {
120120
});
121121

122122
describe("uiCAMeasure", () => {
123+
// this is what, in production, the ./CryptOpt wrapper script does.
124+
vi.stubEnv("PATH", `${process.env.PATH}:${process.env.PWD}/bins/uiCA`);
123125
it("should use the uica lib and error out if no arch is specified.", () => {
124126
const mu = new MeasureUtil(
125127
undefined as unknown as Measuresuite,

0 commit comments

Comments
 (0)