Skip to content

Instantly share code, notes, and snippets.

@abique
Last active August 29, 2015 14:16
Show Gist options
  • Save abique/8e8c901d632bf6ed9f8f to your computer and use it in GitHub Desktop.
Save abique/8e8c901d632bf6ed9f8f to your computer and use it in GitHub Desktop.
cps-remotely.sh
#!/bin/bash
#You can use this script to compile S2E remotely from another machine (e.g., a Mac).
#For instance, you can edit your code in Qt Creator running on Mac OS X,
#press build (Cmd b) and it will build S2E on a Linux box of your choice.
#Tested with Mac OS X -> Linux. It should work for Linux -> Linux too.
#Customize the config script appropriately ...
HOST=dslab-luke2.epfl.ch
REMOTE_USER=bique
LOCAL_PATH=/Users/abique/develop
REMOTE_PATH=/home/bique/develop
PROJECT=cps
REMOTE_BUILD_PATH=$REMOTE_PATH/build
rsync --del -avz $LOCAL_PATH/$PROJECT $REMOTE_USER@$HOST:$REMOTE_PATH/
ARGS=$(echo $* | sed "s:$LOCAL_PATH:$REMOTE_PATH:")
echo "'ninja $ARGS' at $REMOTE_USER@$HOST:$REMOTE_PATH"
ssh $REMOTE_USER@$HOST "ninja -C $REMOTE_PATH/builds/$PROJECT/ $ARGS" 2>&1 | sed "s:$REMOTE_PATH:$LOCAL_PATH:g"
# ssh $REMOTE_USER@$HOST "S2E_ROOT=$REMOTE_S2E_ROOT && mkdir -p $REMOTE_BUILD_PATH && cd $REMOTE_BUILD_PATH && (((make $MAKE_ARGS | sed -u s:$REMOTE_PATH:$LOCAL_PATH:) 3>&1 1>&2 2>&3 | sed -u s:$REMOTE_PATH:$LOCAL_PATH:) 3>&1 1>&2 2>&3)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment