Skip to content

Commit

Permalink
mount temp_file_dir directory to tmpfs (#165)
Browse files Browse the repository at this point in the history
When the `temp_file_dir` directory is not mounted under tmpfs then
it affects the test result on the tsn ref sw test cases.

By solving the issue, we will check on the `temp_file_dir` folder,
if it is not mounted under tmpfs then we will create and mount it.

Signed-off-by: Choong Yong Liang <yong.liang.choong@intel.com>
  • Loading branch information
YongLiang2022 authored and ws-intel committed Feb 8, 2024
1 parent 1d13d76 commit 64b7493
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
18 changes: 18 additions & 0 deletions json/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -527,3 +527,21 @@ save_result_files(){
;;
esac
}

check_and_mount_tmpfs()
{
TEMP_DIR=$1

CHECK_MOUNT=$(mount | grep $TEMP_DIR)
if [[ -z $CHECK_MOUNT ]]; then
mount -t tmpfs -o mode=0755,nodev,nosuid,strictatime tmpfs $TEMP_DIR
fi

CHECK_TMPFS=$(mount | grep tmpfs | grep $TEMP_DIR)
if [[ -z $CHECK_TMPFS ]]; then
echo "The $TEMP_DIR folder could not be mounted."
echo "$TEMP_DIR is required to be mounted on tmpfs for optimum performance when running TSN Reference App."
echo "Please check if there are any missing permission or memory requirements."
exit 1
fi
}
2 changes: 2 additions & 0 deletions json/opcua-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ if [[ ! -z $OUTPUT_FILE ]]; then
echo "Output temp dir for output file: $TEMP_DIR - inexistent. Exiting."
exit 1
else
check_and_mount_tmpfs $TEMP_DIR

echo -n "" > $TEMP_DIR/$OUTPUT_FILE
ln -sfv $TEMP_DIR/$OUTPUT_FILE .
fi
Expand Down
18 changes: 18 additions & 0 deletions shell/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -576,3 +576,21 @@ setup_link_down_up(){

ip link set $IFACE up
}

check_and_mount_tmpfs()
{
TEMP_DIR=$1

CHECK_MOUNT=$(mount | grep $TEMP_DIR)
if [[ -z $CHECK_MOUNT ]]; then
mount -t tmpfs -o mode=0755,nodev,nosuid,strictatime tmpfs $TEMP_DIR
fi

CHECK_TMPFS=$(mount | grep tmpfs | grep $TEMP_DIR)
if [[ -z $CHECK_TMPFS ]]; then
echo "The $TEMP_DIR folder could not be mounted."
echo "$TEMP_DIR is required to be mounted on tmpfs for optimum performance when running TSN Reference App."
echo "Please check if there are any missing permission or memory requirements."
exit 1
fi
}
1 change: 1 addition & 0 deletions shell/vs1a.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ rm -f ./afxdp-txtstamps.txt
sync

# Improve performance/consistency by logging to tmpfs (system memory)
check_and_mount_tmpfs $TEMP_DIR
ln -sfv $TEMP_DIR/afpkt-txtstamps.txt .
ln -sfv $TEMP_DIR/afxdp-txtstamps.txt .

Expand Down
1 change: 1 addition & 0 deletions shell/vs1b.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pkill txrx-tsn
pkill iperf3

# Improve performance/consistency by logging to tmpfs (system memory)
check_and_mount_tmpfs $TEMP_DIR
ln -sfv $TEMP_DIR/afpkt-rxtstamps.txt .
ln -sfv $TEMP_DIR/afxdp-rxtstamps.txt .

Expand Down

0 comments on commit 64b7493

Please sign in to comment.