Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BBesrour committed Aug 20, 2024
1 parent bce34f5 commit 9984fe7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/main/resources/templates/ocaml/test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# copy code from the assignment or solution to the appropriate test folder
cp_code()
{
mv "$2" "$1"
cd "$1" || exit
rm ./*.ml >/dev/null 2>&1
# shellcheck disable=SC2086
Expand Down Expand Up @@ -48,9 +49,9 @@ find ../${studentParentWorkingDirectoryName}/ -type l | grep -q . && echo "Canno

# include solution and assignment in the tests
# this will only pick up *.ml files in the /src folders if other files are required for the tests this needs to be adjusted
cp_code ${solutionWorkingDirectory}
cp_code ${solutionWorkingDirectory} solution
echo 'include Assignment' > ${solutionWorkingDirectory}/solution.ml
cp_code ${studentParentWorkingDirectoryName}
cp_code ${studentParentWorkingDirectoryName} assignment

# select if tests are run by generated source code as student toplevel code may run before the tests and be able to spoof a runtime signal
echo "let runHidden = $RUN_HIDDEN" > test/runHidden.ml
Expand All @@ -71,7 +72,7 @@ if ! timeout -s SIGTERM $BUILD_TIMEOUT checker/checker.exe; then
fi
# build the student submission
# don't reference the tests or solution, so that we can show the build output to the student and not leak test / solution code
if ! timeout -s SIGTERM $BUILD_TIMEOUT dune build --force assignment; then
if ! timeout -s SIGTERM $BUILD_TIMEOUT dune build --force ${solutionWorkingDirectory}; then
echo "Unable to build submission, please ensure that your code builds and matches the provided interface" >&2
exit 0
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ export class ProgrammingExerciseCustomBuildPlanComponent implements OnChanges {
}
}
if (this.shouldReplacePlaceholders()) {
this.programmingExercise.buildConfig!.buildScript = this.replacePlaceholders(this.originalBuildScript);
this.codeChanged(this.programmingExercise.buildConfig?.buildScript || '');
const updatedBuildScript = this.replacePlaceholders(this.originalBuildScript);
if (updatedBuildScript) {
this.programmingExercise.buildConfig!.buildScript = updatedBuildScript;
this.codeChanged(this.programmingExercise.buildConfig?.buildScript || '');
}
}
}

Expand All @@ -68,9 +71,10 @@ export class ProgrammingExerciseCustomBuildPlanComponent implements OnChanges {
shouldReplacePlaceholders(): boolean {
return (
(!!this.programmingExercise.buildConfig?.assignmentCheckoutPath && this.programmingExercise.buildConfig?.assignmentCheckoutPath !== '') ||
(!!this.programmingExercise.buildConfig?.testCheckoutPath && this.programmingExercise.buildConfig?.testCheckoutPath !== '') ||
!!this.programmingExercise.buildConfig?.buildScript?.includes('${studentParentWorkingDirectoryName}') ||
!!this.programmingExercise.buildConfig?.buildScript?.includes('${testWorkingDirectory}')
(!!this.programmingExercise.buildConfig?.testCheckoutPath &&
this.programmingExercise.buildConfig?.testCheckoutPath !== '' &&
(!!this.programmingExercise.buildConfig?.buildScript?.includes('${studentParentWorkingDirectoryName}') ||
!!this.programmingExercise.buildConfig?.buildScript?.includes('${testWorkingDirectory}')))
);
}

Expand Down

0 comments on commit 9984fe7

Please sign in to comment.