ssh [email protected]

Ref:

https://uworbital.notion.site/How-to-GDB-67f9c81be6974e929e80dcffca9d04ba

Screenshot 2023-09-19 at 5.19.41 PM.png

Basic cmd.pdf

Basic cmd.pdf

scp /Users/genichihashi/Desktop/tests/* [email protected]:~/cs246/1239/a2

<aside> 💡 Testing

Testing a Program Manually and With Simple Automation

Testing - Example 1.mp4

Example 2: Automating the Tests With bash Scripts

Testing - Example 2.mp4

produceOutputs-runSuite.pdf

produceOutputs-runSuite.pdf

</aside>

<aside> 💡 Debugging

how to use valgrind to debug memory issues in a program.

valgrind demonstration.mp4

This video demonstrates using gdb to debug a real (buggy!) program:

Debugging demonstration.mp4

Screenshot 2023-10-11 at 11.01.05 PM.png

</aside>

<aside> 💡 Submission

Marmoset Submit Command

Screenshot 2023-09-19 at 5.22.11 PM.png

**[update_q3.sh]**
#!/bin/bash
./produceOutputs suiteq3.txt ./voting
zip a1q3.zip suiteq3.txt *.in *.out *.args
marmoset_submit cs246 a1q3 a1q3.zip

run with args

../execs/a1q3-provided $(cat sample1.args) < sample1.in

chmod u+x ./update_q3.sh

</aside>

<aside> 💡 Download file to Desktop

Screenshot 2023-09-13 at 11.48.11 AM.png

Screenshot 2023-10-02 at 11.38.27 AM.png

</aside>

Screenshot 2023-01-18 at 2.10.39 PM.png

<aside> 💡 How we compile? - must be in dependency order

g++20m -c vec.cc

g++20m -c vec-impl.cc

g++20m -c main.cc

g++20m vec.o vec-impl.o main.o -o main

./main

Dependency order - interface must be compiled before implementation, client

Build tool spprt for compiling in dependency order (e.g. make) is still a work in progress

Screenshot 2023-10-11 at 11.26.35 AM.png

</aside>

<aside> 💡 Short Cuts (run chmod +x name.sh)

./getOutput.sh a2q2
#!/bin/bash

if [ $# -lt 1 ]; then
  echo "Usage: $0 <executable>"
  exit 1
fi

executable="$1"

if [ ! -x "$executable" ]; then
  echo "Error: '$executable' is not an executable file."
  exit 1
fi

for input_file in *.in; do
  if [ -e "$input_file" ]; then
    output_file="${input_file%.in}.out"
    ./"$executable" < "$input_file" > "$output_file"
    
    echo "Processed: $input_file -> $output_file"
  fi
done

echo "Done!"
./collect.sh **.** suite.txt 
#!/bin/bash

# Check for the correct number of arguments
if [ $# -ne 2 ]; then
  echo "Usage: $0 <directory> <output_file>"
  exit 1
fi

# Assign the directory and output file to variables
directory="$1"
output_file="$2"

# Check if the directory exists
if [ ! -d "$directory" ]; then
  echo "Error: Directory '$directory' does not exist."
  exit 1
fi

# Find files ending with ".in" in the specified directory,
# extract their base names (without path and ".in" extension), and write them to the output file
find "$directory" -type f -name "*.in" -exec basename {} .in \\; > "$output_file"

echo "File names ending with '.in' in $directory have been written to $output_file."

</aside>