diff --git a/install_tomohara_env.sh b/install_tomohara_env.sh new file mode 100755 index 00000000..1bb82d0b --- /dev/null +++ b/install_tomohara_env.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +# ===================================================================== +# Script: install-tomohara-env.sh +# Purpose: Appends the Tomohara dynamic environment setup to ~/.bashrc. +# This script is idempotent. It will not add the configuration +# block if it already exists, preventing configuration duplication. +# ===================================================================== + +# Define the target file and a unique identifier for our configuration block. +BASHRC_FILE="$HOME/.bashrc" +BLOCK_IDENTIFIER="TOMOHARA DYNAMIC PROJECT ENVIRONMENT SETUP" + +# --- Verification Step --- +# Check if the configuration block has already been installed. +# This is the correct way to prevent duplicate entries. +if grep -q "$BLOCK_IDENTIFIER" "$BASHRC_FILE"; then + echo "[INFO] Tomohara environment block already detected in $BASHRC_FILE." + echo "[INFO] No changes are necessary. Exiting." + exit 0 +fi + +# --- Installation Step --- +# The configuration block does not exist. We will now append it. +# A 'here document' with a quoted delimiter ('EOF') is used to ensure +# that variables like $HOME are written literally to the file, not +# expanded by the shell running this script. + +echo "[ACTION] Appending Tomohara v2 environment to $BASHRC_FILE..." + +# Add a newline for clean separation before our block. +echo "" >> "$BASHRC_FILE" + +cat << 'EOF' >> "$BASHRC_FILE" +# ===================================================================== +# === TOMOHARA DYNAMIC PROJECT ENVIRONMENT SETUP (v2) === +# ===================================================================== +# This block dynamically locates the project directory to support forks +# and ensures all paths are portable. + +# --- Part 1: Auto-detect the Project Directory --- +# It will prefer your fork ('shell-scripts-aveey') if it exists. +if [ -d "$HOME/shell-scripts-aveey" ]; then + export TOMOHARA_PROJECT_DIR="$HOME/shell-scripts-aveey" +elif [ -d "$HOME/shell-scripts" ]; then + export TOMOHARA_PROJECT_DIR="$HOME/shell-scripts" +else + # If neither is found, set the variable to empty. + export TOMOHARA_PROJECT_DIR="" +fi + +# --- Part 2: Configure Environment if Project was Found --- +if [ -n "$TOMOHARA_PROJECT_DIR" ]; then + # Set batspp temporary data paths + export BATSPP_BASE="/tmp/batspp" + mkdir -p "$BATSPP_BASE/out" "$BATSPP_BASE/tmp" + export SINGLE_STORE=1 + export BATSPP_OUTPUT="$BATSPP_BASE/out" + export BATSPP_TEMP="$BATSPP_BASE/tmp" + + # Add the project directory to PATH (for scripts like perlgrep.perl) + export PATH="$TOMOHARA_PROJECT_DIR:$PATH" + + # Add the project directory to PYTHONPATH (for python modules) + # NOTE: We use $TOMOHARA_PROJECT_DIR, NOT a hardcoded path. + export PYTHONPATH="$TOMOHARA_PROJECT_DIR:$PYTHONPATH" + + # Source the tomohara-aliases if the file exists + if [ -f "$TOMOHARA_PROJECT_DIR/tomohara-aliases.bash" ]; then + source "$TOMOHARA_PROJECT_DIR/tomohara-aliases.bash" + fi + + # Print confirmation with the detected path + echo "[tomohara-env] Initialized using project dir: $TOMOHARA_PROJECT_DIR" +else + echo "[tomohara-env] WARNING: No project directory found (shell-scripts or shell-scripts-aveey)." +fi + +# --- Part 3: Standard User Bin Directory --- +# This is kept separate as it's a general user setting, not project-specific. +export PATH="$HOME/bin:$PATH" + +# === END TOMOHARA DYNAMIC PROJECT ENVIRONMENT SETUP === +EOF + +# --- Finalization --- +echo "[SUCCESS] The Tomohara environment block has been installed." +echo "To activate the new environment, you must reload your shell configuration." +echo "Run the following command:" +echo " source ~/.bashrc" + +exit 0 diff --git a/requirements.txt b/requirements.txt index 12c75066..7e4797a1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,6 +29,7 @@ pylint pytest pyyaml six +tabulate # #............................................................................... # Optional packages diff --git a/tests/NOBATSPPsudo_test_simplebatspp.ipynb b/tests/NOBATSPPsudo_test_simplebatspp.ipynb index de865a41..e08d5b5d 100644 --- a/tests/NOBATSPPsudo_test_simplebatspp.ipynb +++ b/tests/NOBATSPPsudo_test_simplebatspp.ipynb @@ -2,7 +2,22 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, + "id": "fb2eb784", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [], + "source": [ + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" + ] + }, + { + "cell_type": "code", + "execution_count": null, "id": "6e7a3f53", "metadata": {}, "outputs": [], @@ -13,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "561923b4", "metadata": {}, "outputs": [ @@ -31,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "04d68d13", "metadata": {}, "outputs": [ @@ -49,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "231c0073", "metadata": {}, "outputs": [ @@ -79,7 +94,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "db123939", "metadata": {}, "outputs": [ @@ -105,7 +120,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "8b4b06f1", "metadata": {}, "outputs": [], @@ -115,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "4d23f871", "metadata": {}, "outputs": [ @@ -133,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "ff4914d4", "metadata": {}, "outputs": [], diff --git a/tests/README.ipynb b/tests/README.ipynb index c53f435f..b353ecbd 100644 --- a/tests/README.ipynb +++ b/tests/README.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "47e5bb3c-914c-458d-8401-9172c79b8d2f", "metadata": {}, "outputs": [], @@ -120,7 +120,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "1d30de52-801f-48fd-8145-e60af7a8da18", "metadata": {}, "outputs": [], @@ -132,7 +132,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "3564e6de-0a29-488a-9821-be2f201dd258", "metadata": {}, "outputs": [], @@ -146,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "13ae4c10-0262-4d53-b781-5ccbe17bc11a", "metadata": {}, "outputs": [], @@ -171,12 +171,13 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "c3c687e3-e2a3-4168-b0dd-70727832ab71", "metadata": {}, "outputs": [], "source": [ - "# Global setup\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "#\n", "# NOTE: For reproducibility, the directory name needs to be fixed\n", "# In place of $$, use a pseudo-random number (e,g., 1210)\n", @@ -193,7 +194,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "713811b0", "metadata": {}, "outputs": [ @@ -218,7 +219,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "102d3e2f-04f8-4300-9b90-8104f5eb9d1c", "metadata": {}, "outputs": [], @@ -231,7 +232,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "6edd07c8-b27b-4096-bbdb-c7adc96b2aac", "metadata": {}, "outputs": [ @@ -251,7 +252,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "27990ce0-cf70-4218-8231-3b777078334d", "metadata": {}, "outputs": [ diff --git a/tests/alias-calculator-commands.ipynb b/tests/alias-calculator-commands.ipynb index b61030d8..824e2ce1 100644 --- a/tests/alias-calculator-commands.ipynb +++ b/tests/alias-calculator-commands.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "8be02fe7", "metadata": {}, "outputs": [], @@ -12,12 +12,14 @@ "## Example: \n", "## $ echo 'Hii'\n", "## | Hi?2004l\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "5d49fe75", "metadata": {}, "outputs": [ @@ -44,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "cddb7968", "metadata": {}, "outputs": [ @@ -68,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "17618199", "metadata": {}, "outputs": [], @@ -83,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "c10b6bb2", "metadata": {}, "outputs": [ @@ -111,7 +113,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "09763c6c", "metadata": {}, "outputs": [ @@ -134,7 +136,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "feccc2bf", "metadata": {}, "outputs": [], @@ -148,7 +150,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "64b58554", "metadata": { "scrolled": true @@ -172,7 +174,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "829c5541", "metadata": {}, "outputs": [ @@ -190,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "aa669541", "metadata": {}, "outputs": [ @@ -208,7 +210,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "ed1a5eb4", "metadata": {}, "outputs": [ @@ -226,7 +228,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "04fce435", "metadata": {}, "outputs": [ @@ -246,7 +248,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "e92321e0", "metadata": {}, "outputs": [ @@ -264,7 +266,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "118fe218", "metadata": {}, "outputs": [ @@ -283,7 +285,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "3fee2eef", "metadata": {}, "outputs": [ @@ -301,7 +303,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "94774cdc", "metadata": {}, "outputs": [ @@ -320,7 +322,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "1dc08dcd", "metadata": {}, "outputs": [ @@ -338,7 +340,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "44b20f00", "metadata": {}, "outputs": [ @@ -357,7 +359,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "8f172b7c", "metadata": {}, "outputs": [ @@ -376,7 +378,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "ae402a7b", "metadata": {}, "outputs": [ @@ -395,7 +397,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "167a8dc9", "metadata": {}, "outputs": [ @@ -415,7 +417,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "6b66e5d9", "metadata": {}, "outputs": [ @@ -435,7 +437,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "d3238213", "metadata": {}, "outputs": [ @@ -456,7 +458,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "939c678f", "metadata": {}, "outputs": [ @@ -474,7 +476,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "ad1bf020", "metadata": {}, "outputs": [ @@ -492,7 +494,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "ef676520", "metadata": { "scrolled": true diff --git a/tests/alias-cd-commands.ipynb b/tests/alias-cd-commands.ipynb index c3807a24..866051af 100644 --- a/tests/alias-cd-commands.ipynb +++ b/tests/alias-cd-commands.ipynb @@ -2,20 +2,21 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "273ee5ab", "metadata": { "scrolled": true }, "outputs": [], "source": [ - "# Setup (OPTIONAL - USED IF NEEDED)\n", - "## bind 'set enable-bracketed-paste off'" + "# Global Setup (OPTIONAL - USED IF NEEDED)\n", + "## bind 'set enable-bracketed-paste off'\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "90b1a7f3", "metadata": {}, "outputs": [ @@ -40,7 +41,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "c8665c2d-276b-4376-a666-0f1cf32bab91", "metadata": {}, "outputs": [], @@ -55,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "5e52c8d9", "metadata": {}, "outputs": [], @@ -68,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "29cebb30", "metadata": {}, "outputs": [], @@ -105,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "9e1fb88a", "metadata": {}, "outputs": [ @@ -130,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "6a1cb00b", "metadata": {}, "outputs": [ @@ -154,7 +155,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "8a6085e9", "metadata": {}, "outputs": [], @@ -165,7 +166,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "6cce12a4", "metadata": {}, "outputs": [], @@ -177,7 +178,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "069ed8cc", "metadata": {}, "outputs": [ @@ -204,7 +205,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "36fb8fbd", "metadata": {}, "outputs": [ @@ -236,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "9cce96fc", "metadata": {}, "outputs": [ @@ -262,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "4033a985", "metadata": {}, "outputs": [ @@ -286,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "e4b7b6fc", "metadata": {}, "outputs": [ @@ -310,7 +311,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "14b95b96", "metadata": { "scrolled": true @@ -334,7 +335,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "e4b21b38", "metadata": { "scrolled": true diff --git a/tests/alias-grep-commands.ipynb b/tests/alias-grep-commands.ipynb index 48305990..4e5cce28 100644 --- a/tests/alias-grep-commands.ipynb +++ b/tests/alias-grep-commands.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "9a234961", "metadata": {}, "outputs": [], @@ -12,12 +12,14 @@ "## Example: \n", "## $ echo 'Hii'\n", "## | Hi?2004l\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "36ea45cf", "metadata": {}, "outputs": [ @@ -44,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "118f4d68", "metadata": {}, "outputs": [ @@ -63,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "58f47ac9", "metadata": {}, "outputs": [], @@ -79,7 +81,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "482c3dcb", "metadata": {}, "outputs": [], @@ -108,7 +110,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "ab6448b5", "metadata": {}, "outputs": [ @@ -133,7 +135,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "4eb0b066", "metadata": {}, "outputs": [ @@ -158,7 +160,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "993a90d3", "metadata": {}, "outputs": [], @@ -169,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "37c6221e", "metadata": {}, "outputs": [ @@ -189,7 +191,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "135998e6", "metadata": {}, "outputs": [], @@ -212,7 +214,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "f906642e", "metadata": {}, "outputs": [ @@ -246,7 +248,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "b209fa0d", "metadata": {}, "outputs": [ @@ -271,7 +273,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "66375e3e", "metadata": {}, "outputs": [ @@ -296,7 +298,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "4a61dbfa", "metadata": {}, "outputs": [ @@ -316,7 +318,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "690311c9", "metadata": {}, "outputs": [], @@ -327,7 +329,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "c1709353", "metadata": { "scrolled": true @@ -349,7 +351,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "4221570d", "metadata": {}, "outputs": [ @@ -368,7 +370,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "76128375", "metadata": {}, "outputs": [], @@ -378,7 +380,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "e51dcd01", "metadata": { "scrolled": true @@ -401,7 +403,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "584ac3a6", "metadata": {}, "outputs": [], @@ -413,7 +415,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "4da38cda", "metadata": { "scrolled": true @@ -426,7 +428,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "f7c048b8", "metadata": {}, "outputs": [], @@ -437,7 +439,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "1572700d", "metadata": {}, "outputs": [], @@ -451,7 +453,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "dc3f2836", "metadata": { "scrolled": false diff --git a/tests/alias-html-test.ipynb b/tests/alias-html-test.ipynb index e0e17097..08175cea 100644 --- a/tests/alias-html-test.ipynb +++ b/tests/alias-html-test.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": { "scrolled": true }, @@ -16,12 +16,14 @@ "# $ echo 'Hi'\n", "# | Hi?2004l\n", "\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -35,7 +37,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -50,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -62,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -78,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -108,7 +110,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -128,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -148,7 +150,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -159,7 +161,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -170,7 +172,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -180,7 +182,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -190,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ diff --git a/tests/alias-sanity-checks.ipynb b/tests/alias-sanity-checks.ipynb index aaf2de5a..9cc068ba 100644 --- a/tests/alias-sanity-checks.ipynb +++ b/tests/alias-sanity-checks.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "fe85044f-80ba-433b-b065-f863b8ab92d9", "metadata": {}, "outputs": [], @@ -17,7 +17,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "991f4b31-7cdc-46f0-b48f-e5d4376700f3", "metadata": {}, "outputs": [], @@ -34,7 +34,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "456a7dc5-62ab-4296-83c6-f6af836b0270", "metadata": {}, "outputs": [], @@ -45,18 +45,19 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "22350267-e05d-4ff9-b832-039ee56f83ee", "metadata": {}, "outputs": [], "source": [ "# Global setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "alias encode-nums='perl -pe \"s/\\d/N/g;\"'" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "c38dfb22-3972-46e3-8fc5-ad18190ff6b3", "metadata": {}, "outputs": [ @@ -82,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "fca9d7ee-4c5a-4f10-89a2-cf3c8f9a0011", "metadata": {}, "outputs": [ @@ -101,7 +102,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "4d598d31-fd6e-41cd-add4-b52f19e32e33", "metadata": {}, "outputs": [ @@ -120,7 +121,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "60c62427-c919-4364-afbf-055df2e9ff14", "metadata": {}, "outputs": [ @@ -138,7 +139,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "f9af74e6-2750-48a5-a4fc-a78915eeea3c", "metadata": {}, "outputs": [], @@ -156,7 +157,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "35eb3bde-89df-4199-b184-a0d94eb8b436", "metadata": {}, "outputs": [], @@ -169,7 +170,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "e1ce56c5-8456-451e-8b4e-529bf8dc9710", "metadata": {}, "outputs": [], @@ -183,7 +184,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "c336bfba-17d5-48b5-935c-e056b1d0f566", "metadata": {}, "outputs": [], @@ -203,7 +204,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "7b7e4462-5722-4477-b6ff-ea2ae95ad267", "metadata": {}, "outputs": [ @@ -223,7 +224,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "9eb95e82-7353-4c3a-811b-1f91a727a382", "metadata": {}, "outputs": [ @@ -243,7 +244,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "77229b70-a79e-4309-aab4-b46982d6b077", "metadata": {}, "outputs": [ @@ -264,7 +265,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "cdfde566", "metadata": {}, "outputs": [ @@ -282,7 +283,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "ccbc75db-837a-4ece-ada4-93e0c211850f", "metadata": {}, "outputs": [ @@ -302,7 +303,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "ec4f2c39-c6d2-481a-aa3e-1cc2648c93de", "metadata": {}, "outputs": [ @@ -322,7 +323,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "f8b50c65-50b3-43eb-9a31-3198b3883d4c", "metadata": {}, "outputs": [ @@ -341,7 +342,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "38b8d587-dce4-431f-95c0-6296f4a0330f", "metadata": {}, "outputs": [ @@ -362,7 +363,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "2623d0d4-2399-4146-8478-8a1d484eb15f", "metadata": {}, "outputs": [ @@ -387,7 +388,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "c5fa8aab-da3a-4b3a-aafa-e2fe515e7c5f", "metadata": {}, "outputs": [ diff --git a/tests/alias-trace-misc-commands.ipynb b/tests/alias-trace-misc-commands.ipynb index fe3c379b..7ccc00c1 100755 --- a/tests/alias-trace-misc-commands.ipynb +++ b/tests/alias-trace-misc-commands.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "7f30b45d-2c43-4340-9e3d-ed7650ae8f28", "metadata": {}, "outputs": [], @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "4c2c8f81-fab7-4d27-8ea0-006d5af7cef2", "metadata": {}, "outputs": [], @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "9d4c30cc", "metadata": {}, "outputs": [], @@ -45,13 +45,13 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "cddb7968", "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", - "\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "## Aliases for censoring username and/or numbers\n", "alias testnum=\"sed -r \"s/[0-9]/N/g\"\"\n", "alias testnumhex=\"sed -r \"s/[0-9][A-F][a-F]/N/g\"\"\n", @@ -62,7 +62,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ce58f3f6-2f78-4bff-a96a-23e4f1983d94", "metadata": {}, "outputs": [], @@ -90,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "400e083a-b2b1-48ef-83a2-13805e3a8bd9", "metadata": {}, "outputs": [], @@ -101,7 +101,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "66e35e72-5233-4294-8762-3c65d4ba4e13", "metadata": {}, "outputs": [], @@ -115,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "a0f513ae", "metadata": {}, "outputs": [], @@ -125,7 +125,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "e149fbc9", "metadata": {}, "outputs": [ @@ -152,7 +152,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "ed1a5eb4", "metadata": {}, "outputs": [ @@ -175,7 +175,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "f7c6a03a", "metadata": {}, "outputs": [ @@ -198,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "0a69f15f", "metadata": {}, "outputs": [ @@ -217,7 +217,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "fd7d2c34", "metadata": {}, "outputs": [ @@ -236,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "d6e23378", "metadata": {}, "outputs": [ @@ -257,7 +257,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "28d9cce7", "metadata": {}, "outputs": [ @@ -298,7 +298,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "95bda88c", "metadata": {}, "outputs": [ @@ -330,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "db031306", "metadata": {}, "outputs": [ @@ -358,7 +358,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "659f29b7", "metadata": {}, "outputs": [ @@ -376,7 +376,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "ae8977b2", "metadata": {}, "outputs": [ @@ -404,7 +404,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "29a5af6d", "metadata": {}, "outputs": [ @@ -425,7 +425,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "a8c89aa1", "metadata": {}, "outputs": [ @@ -446,7 +446,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "9f2bfe8c", "metadata": { "scrolled": true @@ -472,7 +472,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "5c1dc2a2", "metadata": {}, "outputs": [], @@ -492,7 +492,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "895d01b9", "metadata": {}, "outputs": [], @@ -504,7 +504,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "4e48f66b", "metadata": {}, "outputs": [], @@ -518,7 +518,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "d5cf2239", "metadata": {}, "outputs": [], @@ -551,7 +551,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "0c36d6d5", "metadata": { "scrolled": true @@ -590,7 +590,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "a19413d5", "metadata": {}, "outputs": [ @@ -615,7 +615,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "169b9a64", "metadata": {}, "outputs": [ @@ -638,7 +638,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "636168eb", "metadata": {}, "outputs": [ @@ -660,7 +660,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "486aec7d", "metadata": {}, "outputs": [ @@ -682,7 +682,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "903ac57f", "metadata": {}, "outputs": [], @@ -700,7 +700,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "cbe6782b", "metadata": {}, "outputs": [ @@ -722,7 +722,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "8f56d6fc", "metadata": {}, "outputs": [ @@ -741,7 +741,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "1985ac69", "metadata": {}, "outputs": [], @@ -754,7 +754,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "c401e80e", "metadata": {}, "outputs": [ @@ -785,7 +785,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "ae4468ab", "metadata": {}, "outputs": [ @@ -804,7 +804,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "id": "aa359b7a-165a-4909-9e1a-405940dc564d", "metadata": {}, "outputs": [ @@ -824,7 +824,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "06a251ce-184b-4c6d-81e0-ae6a7bfe5837", "metadata": {}, "outputs": [], @@ -835,7 +835,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "id": "1c375a69", "metadata": {}, "outputs": [], @@ -866,7 +866,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "id": "f0222991", "metadata": {}, "outputs": [ @@ -885,7 +885,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "id": "bc964696", "metadata": {}, "outputs": [], @@ -898,7 +898,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": null, "id": "198d4bae", "metadata": {}, "outputs": [], @@ -910,7 +910,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": null, "id": "b0c3f7d4-591b-4905-ba3e-12cebb2f0c4f", "metadata": { "scrolled": true @@ -926,7 +926,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": null, "id": "60a12cb0-8269-4498-b05c-5bd358da8245", "metadata": {}, "outputs": [ diff --git a/tests/alt-simple-alias-test.ipynb b/tests/alt-simple-alias-test.ipynb index ac759f24..f9a0d460 100644 --- a/tests/alt-simple-alias-test.ipynb +++ b/tests/alt-simple-alias-test.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -12,20 +12,21 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": { "scrolled": true }, "outputs": [], "source": [ "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "alias count-words='wc -w'\n", "alias count-lines='wc -l'" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": { "scrolled": true }, @@ -45,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [ { diff --git a/tests/calc-entropy-tests.ipynb b/tests/calc-entropy-tests.ipynb index 8d8e55a2..8d8a9576 100644 --- a/tests/calc-entropy-tests.ipynb +++ b/tests/calc-entropy-tests.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -13,11 +13,11 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "## BAD (SUPEER BAD)\n", + "## BAD (SUPER BAD)\n", "# # Setup\n", "# bind 'set enable-bracketed-paste off'\n", "# unalias -a\n", @@ -27,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -39,7 +39,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -47,6 +47,7 @@ "# Tests for calc_entropy.perl and calc_entropy.py) scripts\n", "# Settings\n", "## OLD: calc_entropy=calc_entropy.perl\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "calc_entropy=\"perl -Ssw calc_entropy.perl\"\n", "simple=\"-simple\"\n", "verbose=\"-verbose\"\n", @@ -58,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -76,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -114,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -123,7 +124,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -141,7 +142,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -159,7 +160,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -168,7 +169,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -195,7 +196,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -204,7 +205,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -221,7 +222,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": {}, "outputs": [ { diff --git a/tests/command-override-cp-mv.ipynb b/tests/command-override-cp-mv.ipynb index f172af51..34537c01 100644 --- a/tests/command-override-cp-mv.ipynb +++ b/tests/command-override-cp-mv.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "91a402ff", "metadata": {}, "outputs": [], @@ -12,12 +12,13 @@ "## Example: \n", "## $ echo 'Hii'\n", "## | Hi?2004l\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "c33c5c15", "metadata": {}, "outputs": [ @@ -44,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "be8ef5b9", "metadata": {}, "outputs": [ @@ -68,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "1f0c6191", "metadata": {}, "outputs": [], @@ -89,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "8a0854c8", "metadata": {}, "outputs": [], @@ -103,7 +104,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "723a939c", "metadata": {}, "outputs": [ @@ -131,7 +132,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "f1d01696", "metadata": {}, "outputs": [ @@ -154,7 +155,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "c053e45f", "metadata": {}, "outputs": [], @@ -165,7 +166,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "e0d732b4", "metadata": {}, "outputs": [], @@ -177,7 +178,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "92e05aed", "metadata": {}, "outputs": [], @@ -212,7 +213,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "01f003bf", "metadata": {}, "outputs": [ @@ -234,7 +235,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "86397b57", "metadata": {}, "outputs": [ @@ -255,7 +256,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "a5fe54a2", "metadata": {}, "outputs": [], @@ -267,7 +268,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "72f7b672", "metadata": {}, "outputs": [], @@ -277,7 +278,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "29f6f198", "metadata": {}, "outputs": [], @@ -308,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "117d6e03", "metadata": {}, "outputs": [], @@ -319,7 +320,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "e1e7e397", "metadata": {}, "outputs": [], @@ -331,7 +332,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "bcd37f6e", "metadata": {}, "outputs": [], @@ -348,7 +349,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "30f2250d", "metadata": {}, "outputs": [ @@ -375,7 +376,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "f9aebe4f", "metadata": {}, "outputs": [ @@ -395,7 +396,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "a3149319", "metadata": {}, "outputs": [], @@ -424,7 +425,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "9ce01462", "metadata": {}, "outputs": [], @@ -461,7 +462,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "bcea3648", "metadata": {}, "outputs": [ @@ -483,7 +484,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "753c1ba2", "metadata": {}, "outputs": [], @@ -494,7 +495,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "ff3ef38f", "metadata": { "scrolled": true @@ -518,7 +519,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "29b8b028", "metadata": {}, "outputs": [ @@ -543,7 +544,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "2c31c450", "metadata": {}, "outputs": [], @@ -555,7 +556,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "453d4af0", "metadata": {}, "outputs": [], @@ -565,7 +566,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "167288de", "metadata": {}, "outputs": [], @@ -575,7 +576,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "a18198b4", "metadata": {}, "outputs": [ @@ -617,7 +618,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "d6cf3aca", "metadata": { "scrolled": true @@ -630,7 +631,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "5d4aef31", "metadata": {}, "outputs": [], diff --git a/tests/dir-aliases-test-revised.ipynb b/tests/dir-aliases-test-revised.ipynb index 20062093..aa70a4aa 100644 --- a/tests/dir-aliases-test-revised.ipynb +++ b/tests/dir-aliases-test-revised.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "e0037c65", "metadata": {}, "outputs": [], @@ -15,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "c8072444", "metadata": {}, "outputs": [], @@ -30,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "aa716826", "metadata": {}, "outputs": [], @@ -42,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "76000ec1", "metadata": {}, "outputs": [], @@ -68,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "fd292ad6", "metadata": {}, "outputs": [], @@ -84,7 +84,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "a0160916", "metadata": {}, "outputs": [], @@ -95,13 +95,14 @@ "## OLD:\n", "## alias testnum=\"sed -r \"s/[0-9]/N/g\"\" \n", "## alias testuser=\"sed -r \"s/\"$USER\"+/userxf333/g\"\"\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "alias testnum=\"sed -r 's/[0-9]/N/g'\"\n", "alias testuser=\"sed -r \\\"s/\\$USER/userxf333/g\\\"\"" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "95ecb191", "metadata": {}, "outputs": [], @@ -112,7 +113,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "5c9b79f4-a702-4643-aa67-b52663b83665", "metadata": {}, "outputs": [], @@ -125,7 +126,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "191de70b-e4db-4cba-ba46-cefd40b6cc57", "metadata": {}, "outputs": [ @@ -146,7 +147,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "fa5edbaa", "metadata": {}, "outputs": [], @@ -161,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "2fc0293a-45b6-46a6-ac0d-fca15bb9c35e", "metadata": {}, "outputs": [], @@ -172,7 +173,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "3a80dd61-1f0b-447b-a40f-81b98a1334fc", "metadata": {}, "outputs": [], @@ -183,7 +184,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "07038ded", "metadata": {}, "outputs": [], @@ -199,7 +200,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "8368e019", "metadata": {}, "outputs": [], @@ -212,7 +213,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "51e591c6", "metadata": {}, "outputs": [ @@ -235,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "b4d6fad3", "metadata": {}, "outputs": [], @@ -248,7 +249,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "5d186616", "metadata": {}, "outputs": [ @@ -268,7 +269,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "7041eaaf", "metadata": {}, "outputs": [], @@ -301,7 +302,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "64b2b1ef", "metadata": {}, "outputs": [], @@ -312,7 +313,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "cdd285fe", "metadata": {}, "outputs": [], @@ -330,7 +331,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "a82827b2", "metadata": {}, "outputs": [], @@ -341,7 +342,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "6af7ef18", "metadata": {}, "outputs": [], @@ -351,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "90277654", "metadata": {}, "outputs": [ @@ -372,7 +373,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "079f41f3", "metadata": {}, "outputs": [ @@ -396,7 +397,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "f139543a", "metadata": {}, "outputs": [ @@ -418,7 +419,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "088ca7d9", "metadata": { "scrolled": true @@ -440,7 +441,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "df424784", "metadata": { "scrolled": true @@ -457,7 +458,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "cf92e475", "metadata": {}, "outputs": [], @@ -469,7 +470,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "209e21d6", "metadata": {}, "outputs": [ @@ -490,7 +491,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "78312919", "metadata": {}, "outputs": [ @@ -509,7 +510,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "3bdce856", "metadata": { "scrolled": true @@ -537,7 +538,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "4d064e03", "metadata": {}, "outputs": [], @@ -549,7 +550,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "b0bc416c", "metadata": {}, "outputs": [], @@ -564,7 +565,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "40e0e1ae-a8aa-4ae1-9073-d1dfa52266ef", "metadata": {}, "outputs": [ @@ -584,7 +585,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "30835d26", "metadata": { "scrolled": true @@ -605,7 +606,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "e7abee9a", "metadata": {}, "outputs": [ @@ -624,7 +625,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "3c388fb0", "metadata": { "scrolled": true @@ -651,7 +652,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "id": "8a363240", "metadata": {}, "outputs": [ @@ -672,7 +673,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "0dd2e74d", "metadata": {}, "outputs": [ diff --git a/tests/download-and-test-tomohara-aliases.ipynb b/tests/download-and-test-tomohara-aliases.ipynb index f4444246..5f6ff346 100644 --- a/tests/download-and-test-tomohara-aliases.ipynb +++ b/tests/download-and-test-tomohara-aliases.ipynb @@ -2,18 +2,20 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "## BAD APPROACH: rm -rf is very dangerous\n", "## Warning: this creates a temporary directory for aliases\n", - "# /bin/rm -rf /tmp/tomasohara-shell-scripts/*" + "# /bin/rm -rf /tmp/tomasohara-shell-scripts/*\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -29,7 +31,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -47,7 +49,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -57,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -75,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -92,7 +94,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -106,7 +108,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -117,7 +119,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -126,7 +128,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -135,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -152,7 +154,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ diff --git a/tests/dummy-test.ipynb b/tests/dummy-test.ipynb index f39b9279..5382c38c 100644 --- a/tests/dummy-test.ipynb +++ b/tests/dummy-test.ipynb @@ -2,18 +2,20 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "9bddc194", "metadata": {}, "outputs": [], "source": [ "# Dummy test for debugging purposes\n", - "# For use with BatsPP." + "# For use with BatsPP.\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "abb31f9a", "metadata": {}, "outputs": [ @@ -32,7 +34,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "ae0d6781", "metadata": {}, "outputs": [ diff --git a/tests/experimental/alias_tester.py b/tests/experimental/alias_tester.py new file mode 100644 index 00000000..b4859417 --- /dev/null +++ b/tests/experimental/alias_tester.py @@ -0,0 +1,292 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# +# test_aliases.py: Discovers and tests shell aliases from a source file. +# +# This script uses a direct-execution model, sourcing an alias file into a +# non-interactive bash shell to discover and test aliases without external +# test runners like bats-core. It prioritizes portability and robustness. +# + +""" +A framework to automatically discover and test shell aliases directly. + +This script is designed to improve the testing workflow for shell scripts +by automating the validation of aliases in a dependency-free manner. + +Sample usage: + {script} --alias-file ~/shell-scripts/tomohara-aliases.bash --verbose +""" + +# Standard modules +import os +import re +import shutil +import subprocess +import tempfile + +# Local modules +from mezcla import debug +from mezcla import glue_helpers as gh +from mezcla.main import Main + +# Constants for command-line switches +ALIAS_FILE = "alias-file" +VERBOSE = "verbose" +IGNORE_ALIASES = "ignore-aliases" +XFAIL_ALIASES = "xfail-aliases" +SELECT_ALIASES = "select-aliases" + +# Constants +TL = debug.TL + +class Script(Main): + """ + Main class for discovering and directly testing aliases by replicating + the user's configured shell environment. + """ + alias_file = "" + verbose = False + bash_executable = None + bashrc_path = "" + ignore_list = set() + xfail_list = set() + select_list = set() + + def setup(self): + """Check and store results of command line processing.""" + debug.trace(TL.VERBOSE, f"Script.setup(): self={self}") + + default_alias_file = os.path.expanduser("~/shell-scripts/tomohara-aliases.bash") + self.alias_file = self.get_parsed_option(ALIAS_FILE, default_alias_file) + self.verbose = self.get_parsed_option(VERBOSE, self.verbose) + + self.bash_executable = shutil.which("bash") + if not self.bash_executable: + raise FileNotFoundError("Critical Error: 'bash' not found in PATH.") + debug.trace(6, f"Using bash executable: {self.bash_executable}") + + self.bashrc_path = os.path.expanduser("~/.bashrc") + if not os.path.exists(self.bashrc_path): + debug.trace(TL.WARNING, "User ~/.bashrc file not found. Tests may be inaccurate.") + self.bashrc_path = "" + else: + debug.trace(6, f"Located environment setup file: {self.bashrc_path}") + + ignored_str = self.get_parsed_option(IGNORE_ALIASES, "") + if ignored_str: + self.ignore_list = set(name.strip() for name in ignored_str.split(',')) + debug.trace(6, f"Will ignore {len(self.ignore_list)} aliases.") + + xfail_str = self.get_parsed_option(XFAIL_ALIASES, "") + if xfail_str: + self.xfail_list = set(name.strip() for name in xfail_str.split(',')) + debug.trace(6, f"Will expect {len(self.xfail_list)} aliases to fail.") + + select_str = self.get_parsed_option(SELECT_ALIASES, "") + if select_str: + self.select_list = set(name.strip() for name in select_str.split(',')) + debug.trace(6, f"Will select {len(self.select_list)} specific aliases for testing.") + + debug.trace_object(5, self, label=f"{self.__class__.__name__} instance") + + def _get_base_setup_command(self): + """Constructs the setup command string to replicate the shell environment.""" + setup_environment = f"PS1='dummy' && source '{self.bashrc_path}'" if self.bashrc_path else "" + absolute_alias_path = os.path.abspath(self.alias_file) + return f"{setup_environment} && shopt -s expand_aliases && source '{absolute_alias_path}'" + + def run_main_step(self): + """Main processing step: discover, select, filter, and run tests.""" + if not os.path.exists(self.alias_file): + print(f"Error: Alias file not found at '{self.alias_file}'") + return + + all_aliases = self._discover_aliases_directly() + if not all_aliases: + print("No aliases were discovered. Check for errors above.") + return + + candidate_aliases = all_aliases + + if self.select_list: + print(f"--- Selecting {len(self.select_list)} specified aliases for testing ---") + all_discovered_set = set(all_aliases) + selected_and_found = self.select_list.intersection(all_discovered_set) + + not_found = self.select_list - all_discovered_set + if not_found: + print(f"Warning: The following selected aliases were not found and will be skipped: {', '.join(not_found)}") + + candidate_aliases = [alias for alias in all_aliases if alias in selected_and_found] + + aliases_to_test = [alias for alias in candidate_aliases if alias not in self.ignore_list] + + ignored_count = len(candidate_aliases) - len(aliases_to_test) + if ignored_count > 0: + print(f"--- Ignoring {ignored_count} specified aliases from the test run ---") + + self._run_direct_tests_and_report(aliases_to_test) + + def _discover_aliases_directly(self): + """Uses a non-interactive shell to list aliases after building the environment.""" + debug.trace(6, "Discovering aliases within a controlled, non-interactive environment.") + setup_command = self._get_base_setup_command() + command = f"{setup_command} && eval alias" + + ## FIX: Explicitly set check=False to satisfy the W1510 linter warning. + ## Our code handles the return code manually, so this makes our intent clear. + result = subprocess.run( + [self.bash_executable, "-c", command], + capture_output=True, text=True, encoding='utf-8', + stdin=subprocess.DEVNULL, check=False + ) + + if result.returncode != 0: + ## FIX: Removed unnecessary f-string for W1309. + print("Error: Failed during alias discovery. Bash returned an error.") + if result.stderr: + print(f"--- BASH STDERR ---\n{result.stderr.strip()}\n-------------------") + return [] + + discovered_aliases = [] + alias_pattern = re.compile(r"alias\s+([^=]+)='(.*)'") + for line in result.stdout.strip().split('\n'): + match = alias_pattern.match(line) + if match: + discovered_aliases.append(match.group(1)) + + debug.trace(6, f"Discovered {len(discovered_aliases)} aliases.") + return discovered_aliases + + def _run_direct_tests_and_report(self, aliases): + """Tests each alias, categorizing results and showing output intelligently.""" + debug.trace(6, f"Executing direct tests for {len(aliases)} aliases.") + results = {"passed": [], "failed": [], "xfailed": [], "xpassed": []} + setup_command = self._get_base_setup_command() + + show_output = self.verbose or bool(self.select_list) + + print(f"\n--- Running {len(aliases)} Alias Tests ---") + + for i, alias_name in enumerate(aliases): + command_to_test = f"{setup_command} && eval {alias_name}" + print(f"\n({i+1}/{len(aliases)}) Testing alias: '{alias_name}'") + is_xfail = alias_name in self.xfail_list + + try: + with tempfile.TemporaryDirectory() as temp_dir: + process = subprocess.Popen( + [self.bash_executable, "-c", command_to_test], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + text=True, encoding='utf-8', errors='replace', + cwd=temp_dir, stdin=subprocess.DEVNULL + ) + stdout, stderr = process.communicate(timeout=15) + return_code = process.returncode + + def print_output_block(out, err): + if show_output and out: + ## FIX: Removed unnecessary f-string for W1309. + print(" [STDOUT]:") + print("\n".join([f" {line}" for line in out.strip().split('\n')])) + if show_output and err: + ## FIX: Removed unnecessary f-string for W1309. + print(" [STDERR]:") + print("\n".join([f" {line}" for line in err.strip().split('\n')])) + + if return_code == 0: + if is_xfail: + results["xpassed"].append(alias_name) + print(" - [XPASS] Result: 0 (This was expected to fail but passed)") + else: + results["passed"].append(alias_name) + print(" - [PASS] Result: 0") + print_output_block(stdout, stderr) + else: + failure_info = {"name": alias_name, "code": return_code, "stdout": stdout.strip(), "stderr": stderr.strip()} + if is_xfail: + results["xfailed"].append(failure_info) + print(" - [XFAIL] Result: {return_code} (Failure was expected)") + else: + results["failed"].append(failure_info) + print(" - [FAIL] Result: {return_code}") + print_output_block(stdout, stderr) + + except subprocess.TimeoutExpired: + process.kill() + stdout, stderr = process.communicate() + failure_info = {"name": alias_name, "code": "TIMEOUT", "stdout": stdout.strip(), "stderr": "Process timed out after 15 seconds."} + if is_xfail: + results["xfailed"].append(failure_info) + print(" - [XFAIL] Result: TIMEOUT (Failure was expected)") + else: + results["failed"].append(failure_info) + print(" - [FAIL] Result: TIMEOUT") + if show_output and stderr: + print(f" [STDERR]: {failure_info['stderr']}") + + ## FIX: Silenced the W0718 warning. Catching a broad exception is intentional here + ## to ensure any unexpected error in one test doesn't crash the entire suite. + except Exception as e: # pylint: disable=broad-exception-caught + failure_info = {"name": alias_name, "code": "EXCEPTION", "stderr": str(e)} + results["failed"].append(failure_info) + ## FIX: Removed unnecessary f-string for W1309. + print(" - [FAIL] Result: EXCEPTION") + print(f" [ERROR]: {str(e)}") + + passed_count = len(results["passed"]) + failed_count = len(results["failed"]) + xfailed_count = len(results["xfailed"]) + xpassed_count = len(results["xpassed"]) + + print("\n\n--- Alias Test Report ---") + print(f"Alias File: {self.alias_file}") + print(f"Summary: {len(aliases)} tests run -> " + f"{passed_count} passed, {failed_count} failed, " + f"{xfailed_count} expected failures (xfail), {xpassed_count} unexpected passes (xpass)") + ## FIX: Removed unnecessary f-string for W1309. + print("-------------------------\n") + + if results["failed"]: + ## FIX: Removed unnecessary f-string for W1309. + print("Unexpected Failures (Require Investigation):") + for failure in results["failed"]: + print(f" - [FAIL] {failure['name']} (Result: {failure['code']})") + if failure.get('stderr') and self.verbose: + stderr_summary = (failure['stderr'].split('\n')[0]) + print(f" [Info]: {stderr_summary}") + print("") + + if results["xpassed"]: + ## FIX: Removed unnecessary f-string for W1309. + print("Unexpected Passes (Review `xfail` List):") + for alias_name in results["xpassed"]: + print(f" - [XPASS] {alias_name}") + print("") + +def main(): + """Entry point""" + app = Script( + description=__doc__.format(script=gh.basename(__file__)), + skip_input=True, + text_options=[ + (ALIAS_FILE, "Path to the alias file to test (e.g., tomohara-aliases.bash)"), + (IGNORE_ALIASES, "A comma-separated list of aliases to ignore during testing."), + (XFAIL_ALIASES, "A comma-separated list of aliases that are expected to fail."), + (SELECT_ALIASES, "A comma-separated list of specific aliases to test, ignoring all others.") + ], + boolean_options=[ + (VERBOSE, "Enable verbose output to show pass/fail status for each alias.") + ]) + app.run() + debug.assertion(not any(re.search(r"^TODO_", m, re.IGNORECASE) + for m in dir(app))) + +#------------------------------------------------------------------------------- + +if __name__ == '__main__': + debug.trace_current_context(level=TL.QUITE_VERBOSE) + debug.trace(5, f"module __doc__: {__doc__}") + debug.assertion("TODO:" not in __doc__, "Please fill out the main docstring.") + main() \ No newline at end of file diff --git a/tests/experimental/batspp-output/test_01_simple_example.bats.outputpp.out b/tests/experimental/batspp-output/test_01_simple_example.bats.outputpp.out new file mode 100644 index 00000000..962960d4 --- /dev/null +++ b/tests/experimental/batspp-output/test_01_simple_example.bats.outputpp.out @@ -0,0 +1,25 @@ + +1..3 + +========== actual: "# handshake\n$ echo "System online. Awaiting orders."\n" ========== +System online. Awaiting orders. +========== expect: "System online. Awaiting orders." ========== +System online. Awaiting orders. +============================ +ok 1 test-1 + +========== actual: "# arithmetic\n$ echo $((100 + 50))\n" ========== +150 +========== expect: "150" ========== +150 +============================ +ok 2 test-3 + +========== actual: "TODO\n" ========== + +========== expect: "add-todo "[within N weeks] ..X."" ========== +add-todo "[within N weeks] ..X." +============================ +not ok 3 test-4 + +3 tests, 1 failure(s) diff --git a/tests/experimental/batspp/test_01_simple_example.batspp b/tests/experimental/batspp/test_01_simple_example.batspp new file mode 100644 index 00000000..40e06e4a --- /dev/null +++ b/tests/experimental/batspp/test_01_simple_example.batspp @@ -0,0 +1,11 @@ +# handshake +$ echo "System online. Awaiting orders." +System online. Awaiting orders. + +# arithmetic +$ echo $((100 + 50)) +150 + +$ TODO +add-todo "[within N weeks] ..X." + diff --git a/tests/experimental/macro_failure_analyzer.py b/tests/experimental/macro_failure_analyzer.py new file mode 100644 index 00000000..8bf7ab7f --- /dev/null +++ b/tests/experimental/macro_failure_analyzer.py @@ -0,0 +1,155 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +## TODO: Mezcla-fy the script with template.py + +""" +Macro Failure Analyzer + +Analyzes BATS test logs to identify macros most correlated with test failures. +The script examines test output files (*.out) to determine failure rates for each macro. + +Features: +- Automatically detects macros using show-macros-proper +- Handles both direct file paths and directory scanning +- Calculates failure rates and presents ranked results +- Supports both interactive and non-interactive command execution +""" + +import subprocess +import glob +from collections import defaultdict +import os +import argparse + +def run_interactive_command(command_to_run): + """Execute a command in an interactive bash shell with environment setup. + + Args: + command_to_run (str): The command to execute + + Returns: + str: The command output or empty string on failure + """ + try: + full_command_string = ( + 'export PATH="$HOME/shell-scripts:$PATH"; ' + 'source ~/.bashrc &>/dev/null; ' + f'{command_to_run}' + ) + result = subprocess.run( + ['bash', '-i', '-c', full_command_string], + capture_output=True, text=True, check=True, timeout=20 + ) + return result.stdout.strip() + except (subprocess.TimeoutExpired, subprocess.CalledProcessError) as exc: + print(f"Interactive command failed with stderr:\n{exc.stderr}") + return "" + +def run_command(command_to_run): + """Execute a command directly with modified PATH environment. + + Args: + command_to_run (str): The command to execute + + Returns: + str: The command output or empty string on failure + """ + try: + env = os.environ.copy() + env['PATH'] = f"{os.path.expanduser('~')}/shell-scripts:{env['PATH']}" + result = subprocess.run( + command_to_run, + shell=True, capture_output=True, text=True, timeout=20, env=env, + check=False # Explicitly set check=False to handle errors manually + ) + return result.stdout.strip() + except subprocess.TimeoutExpired: + return "" + +def analyze_failures(log_pattern): + """ + Analyze test logs to find macros with highest failure correlation. + + Args: + log_pattern (str): Path pattern or directory for log files + """ + print("--- Running Failure Analysis Heuristic (v1.3) ---") + + num_total = defaultdict(int) + num_bad = defaultdict(int) + + print("Fetching macros using 'show-macros-proper' (interactive mode)...") + macros = run_interactive_command("show-macros-proper").split() + if not macros: + print("\nFatal Error: Could not fetch macros. Analysis cannot continue.") + return + print(f"Found {len(macros)} macros/functions to analyze.") + + # Path handling logic + expanded_path = os.path.expanduser(log_pattern) + if os.path.isdir(expanded_path): + print("INFO: Target path is a directory. Searching for '*.out' files within.") + log_pattern = os.path.join(expanded_path, '*.out') + + log_files = glob.glob(os.path.expanduser(log_pattern)) + if not log_files: + print(f"\nError: No log files found matching pattern '{log_pattern}'") + print("Ensure tests have been run and the path is correct.") + return + print(f"Scanning {len(log_files)} log file(s)...") + + print("Analyzing log snippets for macro presence (non-interactive mode)...") + for macro in macros: + perlgrep_cmd = rf"perlgrep.perl -para '{macro}' {' '.join(log_files)}" + snippets_output = run_command(perlgrep_cmd) + + if not snippets_output: + continue + + for snippet in snippets_output.split('\n\n'): + if not snippet: + continue + + num_total[macro] += 1 + if "not ok" in snippet: + num_bad[macro] += 1 + + if not num_total: + print("\nAnalysis complete. No usage of the found macros was detected in the logs.") + return + + results = [] + for macro in num_total: + if num_total[macro] > 0: + pct = (num_bad[macro] / num_total[macro]) * 100 + results.append((macro, num_bad[macro], num_total[macro], pct)) + + results.sort(key=lambda item: (item[3], item[2]), reverse=True) + + print("\n--- Failure Analysis Report ---") + print(f"{'Suspect Macro/Function':<30} {'Failures':<10} {'Total Uses':<12} {'Failure Rate':<15}") + print("-" * 70) + for macro, bad, total, pct in results: + print(f"{macro:<30} {bad:<10} {total:<12} {pct:.2f}%") + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Analyzes BATS test logs to find macros most correlated with failures." + ) + parser.add_argument( + 'log_files', + nargs='?', + default=None, + help="Path pattern or directory for log files. If not provided, the script expects the path from an orchestrator." + ) + args = parser.parse_args() + + log_path_pattern = args.log_files + if log_path_pattern is None: + default_dir = os.path.expanduser('~/shell-scripts/tests/batspp-output') + print(f"INFO: No log path provided. Using default fallback: {default_dir}") + log_path_pattern = default_dir + + analyze_failures(log_path_pattern) \ No newline at end of file diff --git a/tests/experimental/run_diagnostics.py b/tests/experimental/run_diagnostics.py new file mode 100644 index 00000000..b4d11820 --- /dev/null +++ b/tests/experimental/run_diagnostics.py @@ -0,0 +1,141 @@ +#!/usr/bin/env python3 + +"""Automate the test execution and failure analysis pipeline (experimental)""" +## TODO: Mezcla-fy the script with template.py + +# SCRIPT_NAME: run_diagnostics.py +# MISSION: Automate the test execution and failure analysis pipeline. +# VERSION: 1.2 +# PATCH NOTES: +# - Added DIAG_VERBOSE flag to provide real-time test output to console. +# - Corrected data handoff to the analyzer script, which now receives +# the output directory as a command-line argument. +# - Re-engineered pathing logic to be self-aware of script location. +# - Paths are now constructed relative to this file, not the current +# working directory, ensuring robust execution from any location. +# +import sys + +# Local Framework Modules +try: + from mezcla import glue_helpers as gh + from mezcla import system + from mezcla.my_regex import my_re +except ImportError: + # Cannot use system.exit if system module itself failed to import. + print("CRITICAL: 'mezcla' framework not found. Ensure PYTHONPATH is correctly configured.") + sys.exit(1) + +# --- SELF-AWARENESS UPGRADE --- +# Determine the absolute directory where this script resides. +# All subsequent paths will be calculated from this fixed point. +SCRIPT_PATH = system.real_path(__file__) +SCRIPT_DIR, _ = system.split_path(SCRIPT_PATH) + +# --- OPERATIONAL PARAMETERS --- +# Paths are now robustly constructed from the script's known location. +BATSPP_SOURCE_DIR = gh.form_path(SCRIPT_DIR, "batspp") +BATSPP_OUTPUT_DIR = gh.form_path(SCRIPT_DIR, "batspp-output") +ANALYZER_SCRIPT = gh.form_path(SCRIPT_DIR, "macro_failure_analyzer.py") +PROCESSOR_SCRIPT = gh.form_path(SCRIPT_DIR, "../../simple_batspp.py") + +# PROTOCOL UPGRADE: VERBOSE MODE AWARENESS +IS_VERBOSE = system.getenv_value("DIAG_VERBOSE", "0") == "1" + + +def main(): + """ + Primary execution controller for the diagnostic mission. + """ + print("="*60) + print("INITIALIZING DIAGNOSTIC ORCHESTRATION PROTOCOL (v1.2)...") + print("="*60) + + # --- PHASE 1: CONFIGURATION AND TARGET ACQUISITION --- + + gh.full_mkdir(BATSPP_OUTPUT_DIR) + print(f"STATUS: Secure output channel established at '{BATSPP_OUTPUT_DIR}/'") + + # PROTOCOL UPGRADE: Announce verbose status + if IS_VERBOSE: + print("STATUS: Verbose mode is ACTIVE. Live tactical feed enabled.") + else: + print("STATUS: Verbose mode is INACTIVE. Output will be logged silently.") + + test_regex = system.getenv_value("TEST_REGEX", None, description="Regex for tests to include") + if test_regex: + print(f"INFO: Targeting filter active. TEST_REGEX = '{test_regex}'") + else: + print("INFO: No targeting filter. All operatives will be deployed.") + + # The operative now correctly reads from its own subdirectory. + try: + all_assets = system.read_directory(BATSPP_SOURCE_DIR) + except FileNotFoundError: + print(f"\nCRITICAL ERROR: Source directory not found at '{BATSPP_SOURCE_DIR}'.") + print("Ensure the 'batspp' directory exists alongside the run_diagnostics.py script.") + system.exit(1) + + target_files = [] + for asset in all_assets: + if not asset.endswith(".batspp"): + continue + + if test_regex and not my_re.search(fr"{test_regex}", asset): + print(f"FILTER: Asset '{asset}' does not match target profile. Standing down.") + continue + + target_files.append(asset) + + if not target_files: + print(f"\nMISSION ABORTED: No valid targets acquired in '{BATSPP_SOURCE_DIR}'.") + system.exit(1) + + print(f"\nTARGETS ACQUIRED: {len(target_files)} test asset(s) confirmed.") + print("-" * 60) + + # --- PHASE 2: TEST EXECUTION --- + + print("BEGINNING TEST EXECUTION PHASE...") + + for batspp_file in target_files: + input_path = gh.form_path(BATSPP_SOURCE_DIR, batspp_file) + output_filename = batspp_file.replace('.batspp', '.bats.outputpp.out') + output_path = gh.form_path(BATSPP_OUTPUT_DIR, output_filename) + + base_command = f"BASH_EVAL=1 GLOBAL_TEST_DIR=1 PARA_BLOCKS=1 python3 {PROCESSOR_SCRIPT} {input_path}" + + # PROTOCOL UPGRADE: DYNAMIC OUTPUT REDIRECTION + if IS_VERBOSE: + # Use `tee` to send output to both console and file + command = f"{base_command} 2>&1 | tee {output_path}" + else: + # Original silent logging + command = f"{base_command} > {output_path} 2>&1" + + print(f" EXECUTING: {batspp_file}...") + # For verbose mode, we want to see the output live, so we don't capture it here. + gh.run(command, capture_output=False) + print(f" LOGGED: Output secured at '{output_path}'") + + print("TEST EXECUTION PHASE COMPLETE.") + print("-" * 60) + + # --- PHASE 3: FAILURE ANALYSIS --- + + print("BEGINNING AUTOMATED FAILURE ANALYSIS...") + # PROTOCOL UPGRADE: DIRECTING THE ANALYZER + # Pass the output directory as an argument so the analyzer knows where to find the logs. + analysis_command = f"python3 {ANALYZER_SCRIPT} {BATSPP_OUTPUT_DIR}" + print(f" INVOKING: {analysis_command}") + analysis_report = gh.run(analysis_command) + + print("ANALYSIS COMPLETE. FINAL REPORT FOLLOWS:") + print("="*60) + print(analysis_report) + print("="*60) + print("MISSION ACCOMPLISHED.") + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/tests/extract_duplicate_aliases.py b/tests/extract_duplicate_aliases.py new file mode 100644 index 00000000..2a4e3627 --- /dev/null +++ b/tests/extract_duplicate_aliases.py @@ -0,0 +1,319 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Find duplicate alias definitions in bash scripts or configuration files. + +Sample usage: + python3 {script} ~/shell-scripts + python3 {script} ~/shell-scripts --check-definitions + python3 {script} ~/shell-scripts --exclude /path/to/exclude + python3 {script} ~/.bashrc --verbose + python3 {script} ~/shell-scripts --json +""" + +# Standard modules +import json +import os +import re +from collections import defaultdict + +# Local modules +from mezcla import debug +from mezcla import glue_helpers as gh +from mezcla.main import Main +from mezcla.my_regex import my_re +from mezcla import system + +debug.trace(5, f"global __doc__: {__doc__}") +debug.assertion(__doc__) + +# Constants for switches +CHECK_DEFINITIONS = "check-definitions" +EXCLUDE_PATH = "exclude" +JSON_OUTPUT = "json" + +# Constants +TL = debug.TL + +# Environment options +ALIAS_VERBOSE = system.getenv_bool( + "ALIAS_VERBOSE", False, + description="Enable verbose alias processing") + +class AliasFinder: + """Helper class for finding duplicate alias definitions""" + + def __init__(self, verbose=False): + self.alias_pattern = re.compile(r'^\s*alias\s+([^=\s]+)\s*=\s*(.*)$', my_re.MULTILINE) + self.verbose = verbose + self.shell_extensions = ['.sh', '.bash', '.zsh', '.csh', '.fish'] + self.shell_configs = ['.bashrc', '.bash_profile', '.zshrc', '.profile', + 'bashrc', 'bash_profile', 'zshrc', 'profile'] + + def log(self, message): + """Print debug message if verbose""" + if self.verbose: + debug.trace(4, f"AliasFinder: {message}") + + def find_shell_files(self, path, exclude_paths=None): + """Find all shell script files, excluding specified paths""" + exclude_paths = exclude_paths or [] + path = os.path.expanduser(path) + exclude_paths = [os.path.expanduser(p) for p in exclude_paths] + + self.log(f"Searching in: {path}") + + if not os.path.exists(path): + return [] + + if os.path.isfile(path): + return [path] if not self._is_excluded(path, exclude_paths) else [] + + shell_files = [] + for root, dirs, files in os.walk(path): + if self._is_excluded(root, exclude_paths): + continue + + # Skip excluded directories + dirs[:] = [d for d in dirs if not self._is_excluded(os.path.join(root, d), exclude_paths)] + + for file in files: + file_path = os.path.join(root, file) + + if self._is_excluded(file_path, exclude_paths): + continue + + if self._is_shell_file(file): + shell_files.append(file_path) + self.log(f"Found: {file_path}") + + return shell_files + + def _is_excluded(self, path, exclude_paths): + """Check if path should be excluded""" + if not exclude_paths: + return False + + path = os.path.abspath(path) + for excluded in exclude_paths: + excluded = os.path.abspath(excluded) + if path == excluded or path.startswith(excluded + os.sep): + return True + return False + + def _is_shell_file(self, filename): + """Check if file is a shell script""" + return (any(filename.endswith(ext) for ext in self.shell_extensions) or + filename in self.shell_configs or + filename.startswith('.bash')) + + def extract_aliases(self, file_path): + """Extract aliases from a single file""" + aliases = [] + + try: + lines = system.read_lines(file_path) + + for line_num, line in enumerate(lines, 1): + match = self.alias_pattern.match(line) + if match: + aliases.append({ + 'name': match.group(1).strip(), + 'definition': match.group(2).strip(), + 'file': file_path, + 'line': line_num, + 'actual_line': line.strip() + }) + + except (FileNotFoundError, IOError) as e: + debug.trace(3, f"Could not read {file_path}: {e}") + except UnicodeDecodeError as e: + debug.trace(3, f"Could not decode {file_path}: {e}") + + self.log(f"Found {len(aliases)} aliases in {file_path}") + return aliases + + + def find_duplicates(self, files, check_definitions=False): + """Find duplicate aliases across files""" + all_aliases = [] + for file_path in files: + all_aliases.extend(self.extract_aliases(file_path)) + + self.log(f"Total aliases found: {len(all_aliases)}") + + # Group by alias name + name_groups = defaultdict(list) + for alias in all_aliases: + name_groups[alias['name']].append(alias) + + # Find duplicates + duplicates = {k: v for k, v in name_groups.items() if len(v) > 1} + + if check_definitions: + # Only show duplicates with different definitions + filtered_duplicates = {} + for name, aliases in duplicates.items(): + definitions = set(alias['definition'] for alias in aliases) + if len(definitions) > 1: # Multiple different definitions + filtered_duplicates[name] = aliases + duplicates = filtered_duplicates + + return duplicates + +class ExtractDuplicateAliases(Main): + """Alias duplicate finder script""" + + check_definitions = False + path = "" + exclude_paths = [] + json_output = False + + def setup(self): + """Process command line arguments""" + debug.trace(TL.VERBOSE, f"Script.setup(): self={self}") + + self.check_definitions = self.get_parsed_option(CHECK_DEFINITIONS, self.check_definitions) + self.json_output = self.get_parsed_option(JSON_OUTPUT, self.json_output) + + # Handle exclude paths (can be specified multiple times) + exclude_option = self.get_parsed_option(EXCLUDE_PATH, []) + if isinstance(exclude_option, str): + self.exclude_paths = [exclude_option] + elif isinstance(exclude_option, list): + self.exclude_paths = exclude_option + else: + self.exclude_paths = [] + + # Get the path argument + self.path = self.get_parsed_argument("path", ".") + + debug.trace_object(5, self, label=f"{self.__class__.__name__} instance") + + def print_readable_output(self, result): + """Print results in clean readable format""" + if result["status"] == "error": + print(f"Error: {result['message']}") + return + + print("Duplicate Alias Analysis") + print("=" * 50) + print(f"Path analyzed: {result['path']}") + print(f"Files analyzed: {result['total_files']}") + + if self.exclude_paths: + print(f"Excluded paths: {', '.join(self.exclude_paths)}") + + if self.check_definitions: + print("Mode: Only showing aliases with different definitions") + else: + print("Mode: Showing all duplicate alias names") + + print() + + if not result['duplicates']: + print("No duplicate aliases found.") + return + + print(f"Found {result['unique_duplicates']} unique duplicate aliases:") + print() + + for duplicate in result['duplicates']: + print(f"Alias: {duplicate['alias']} ({duplicate['occurrences']} occurrences)") + print("-" * 40) + + for location in duplicate['locations']: + print(f" File: {location['file']}") + print(f" Line {location['line_number']}: {location['line_content']}") + print(f" Definition: {location['definition']}") + print() + + def run_main_step(self): + """Main processing step""" + debug.trace(5, f"Script.run_main_step(): self={self}") + + # Create finder + finder = AliasFinder(verbose=self.verbose) + + # Find shell files + shell_files = finder.find_shell_files(self.path, self.exclude_paths) + + if not shell_files: + result = { + "status": "error", + "message": f"No shell scripts found in {self.path}", + "path": self.path, + "files_analyzed": [], + "duplicates": [] + } + + if self.json_output: + print(json.dumps(result, indent=2)) + else: + self.print_readable_output(result) + return + + # Find duplicates + duplicates = finder.find_duplicates(shell_files, self.check_definitions) + + # Format results + duplicate_list = [] + for name, aliases in duplicates.items(): + duplicate_entry = { + "alias": name, + "occurrences": len(aliases), + "locations": [] + } + + for alias in aliases: + location = { + "file": alias['file'], + "line_number": alias['line'], + "line_content": alias['actual_line'], + "definition": alias['definition'] + } + duplicate_entry["locations"].append(location) + + duplicate_list.append(duplicate_entry) + + # Sort by occurrences (descending) + duplicate_list.sort(key=lambda x: x['occurrences'], reverse=True) + + result = { + "status": "success", + "path": self.path, + "files_analyzed": shell_files, + "total_files": len(shell_files), + "unique_duplicates": len(duplicates), + "check_definitions": self.check_definitions, + "duplicates": duplicate_list + } + + if self.json_output: + print(json.dumps(result, indent=2)) + else: + self.print_readable_output(result) + +def main(): + """Entry point""" + app = ExtractDuplicateAliases( + description=__doc__.format(script=gh.basename(__file__)), + skip_input=True, + manual_input=True, + auto_help=True, + boolean_options=[ + (CHECK_DEFINITIONS, "Only show aliases with different definitions"), + (JSON_OUTPUT, "Output results in JSON format"), + ], + text_options=[ + (EXCLUDE_PATH, "Paths to exclude (can be specified multiple times)"), + ], + positional_arguments=["path"], + float_options=None + ) + app.run() + +if __name__ == '__main__': + debug.trace_current_context(level=TL.QUITE_VERBOSE) + debug.trace(5, f"module __doc__: {__doc__}") + main() diff --git a/tests/failure_analyzer.py b/tests/failure_analyzer.py new file mode 100644 index 00000000..ebb48a74 --- /dev/null +++ b/tests/failure_analyzer.py @@ -0,0 +1,347 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# +# failure_analyzer.py: Analyzes BATS++ test failures to identify suspect commands. +# +# v18-addon.24: Restored `bash -i` to create an interactive shell, which correctly loads the user's environment and functions. +# v18-addon.23: Export EGREP=egrep to satisfy dependencies in user's shell function. (Reverted) +# v18-addon.22: Force non-interactive shell to source ~/.bashrc to load user-defined functions. (Reverted) +# v18-addon.21: Addressed Pylint feedback: C0321 (multiple-statements) and W0718 (broad-exception-caught). +# v18-addon.18: REMOVED '-i' flag from gh.run to prevent interactive shell from overwriting PATH. (Mistake) +# +## TODO: Create test_failure_analyzer.py to test the new heuristic logic. + +""" +Analyzes BATSPP test failures to identify and rank suspect commands. + +This script offers two modes of analysis: +1. Default Mode: Identifies failing test code blocks. +2. Heuristic Mode (--heuristic): Estimates the failure probability for each Bash macro/function + and lists the files where failures occur directly in the console output. + +Sample usage: + # Original analysis (blames code blocks) -> outputs failure_analyzer_report.json + {script} /path/to/results + + # New heuristic analysis (blames macros) -> outputs failure_analyzer_heuristic.json + {script} /path/to/results --heuristic +""" + +# Standard modules +import json +import os +import subprocess +from collections import defaultdict +from pathlib import Path + +# Local modules +from mezcla import system +from mezcla import debug +from mezcla import glue_helpers as gh +from mezcla.main import Main +from mezcla.my_regex import my_re + +# Installed modules +try: + from tabulate import tabulate +except ImportError: + system.exit("Error: The 'tabulate' library is required. Please run 'pip install tabulate'.", status_code=1) + + +# Constants for switches omitting leading dashes +RESULTS_DIR = "results-dir" +JSON_FILENAME = "json-filename" +DIAGNOSTIC_MODE = "diagnostic" +HEURISTIC_MODE = "heuristic" + +# Constants +TL = debug.TL + +# ------------------------------------------------------------------------------ +# Core Logic Class (API) +# ------------------------------------------------------------------------------ + +class FailureAnalyzer: + """ + Main logic class for analyzing BATS++ failures. Encapsulates all analysis, + file processing, and reporting. + """ + + def __init__(self, results_dir: str, is_heuristic: bool, json_filename: str | None = None): + """Initializes the analyzer with all necessary parameters.""" + self.results_dir = results_dir + self.is_heuristic = is_heuristic + self.json_filename = self._resolve_json_filename(json_filename) + self.report_data = [] + + def run(self): + """ + Main orchestration method. Runs the analysis, writes the report, + and prints the summary table. + """ + if self.is_heuristic: + self.report_data = self._analyze_macro_failures() + else: + self.report_data = self._analyze_test_run() + + if not self.report_data: + if self.is_heuristic: + print("\nAnalysis complete. No macro usage was found in test outputs.") + else: + print("\nAnalysis complete. No actionable failures were extracted.") + return + + self._write_json_report() + self._print_summary_table() + + def _resolve_json_filename(self, json_filename: str | None) -> str: + """Determines the correct output path for the JSON report.""" + if json_filename: + return json_filename + default_name = "failure_analyzer_heuristic.json" if self.is_heuristic else "failure_analyzer_report.json" + return os.path.join(self.results_dir, default_name) + + def _find_output_files(self) -> list[str]: + """Find all BATS++ output files (*.outputpp.out) recursively.""" + matched_files = [] + dirs_to_visit = [self.results_dir] + while dirs_to_visit: + current_dir = dirs_to_visit.pop() + try: + for name in system.read_directory(current_dir): + full_path = os.path.join(current_dir, name) + if system.is_directory(full_path): + dirs_to_visit.append(full_path) + elif name.endswith('.outputpp.out'): + matched_files.append(full_path) + except IOError as e: + debug.trace(TL.ERROR, f"Could not process directory {current_dir}: {e}") + return sorted(matched_files) + + def _find_failed_tests(self, output_file_path: str) -> list[str]: + """Parses a .outputpp.out file for "not ok ..." lines.""" + pattern = r"^\s*not ok\s+\d+\s+-?\s*(.+)$" + try: + content = system.read_file(output_file_path, errors='ignore') + if not content: + return [] + matches = my_re.findall(pattern, content, my_re.MULTILINE) + return list({m.strip().split('#')[0].strip() for m in matches}) if matches else [] + except IOError as e: + debug.trace(TL.ERROR, f"Error reading file {output_file_path}: {e}") + return [] + + def _extract_from_generated_script(self, script_path: str, test_name: str) -> str | None: + """Extracts suspect command from the generated script.""" + if not system.file_exists(script_path): + return None + try: + content = system.read_file(script_path, errors='ignore') + if not content: + return None + sanitized_test_name = my_re.escape(test_name.replace(' ', '_')) + pattern = rf"^\s*(?:function\s+)?{sanitized_test_name}[-_]actual\s*\(\)\s*{{((?:.|\n)*?)^\s*}}?\s*$" + match = my_re.search(pattern, content, my_re.MULTILINE) + if not match: + return None + function_body = match.group(1) + cleaned_lines = [l.strip() for l in function_body.splitlines() if l.strip() and not l.strip().startswith(('#', 'true', '}'))] + return "\n".join(cleaned_lines) if cleaned_lines else None + except IOError as e: + debug.trace(TL.WARNING, f"Failed to process {script_path}: {str(e)}") + return None + + def _analyze_test_run(self) -> list: + """Orchestrates the original analysis, blaming test blocks.""" + aggregated_failures = defaultdict(lambda: {'sources': set(), 'count': 0}) + print("--- Audit Trail: Processing Failure Logs (Original Mode) ---") + output_files = self._find_output_files() + if not output_files: + print(f"No output files (*.outputpp.out) found in directory: {self.results_dir}") + return [] + for output_file_str in output_files: + output_file = Path(output_file_str) + failed_tests = self._find_failed_tests(output_file_str) + if not failed_tests: + continue + base_name = output_file.name.replace('.outputpp.out', '') + source_filename = f"{base_name}.batspp" + generated_script_path = str(output_file.with_name(f"{base_name}.outputpp")) + print(f" -> Analyzing {len(failed_tests)} failure(s) in: {source_filename}") + for test_name in failed_tests: + suspect = self._extract_from_generated_script(generated_script_path, test_name) + if suspect: + aggregated_failures[suspect]['sources'].add(source_filename) + aggregated_failures[suspect]['count'] += 1 + print("-" * 54) + if not aggregated_failures: + return [] + for data in aggregated_failures.values(): + data['impact'] = data['count'] * len(data['sources']) + return sorted(aggregated_failures.items(), key=lambda item: item[1]['impact'], reverse=True) + + def _analyze_macro_failures(self) -> list: + """Estimates which macros/functions are failing the most.""" + print("--- Running Macro Failure Heuristic Analysis ---") + try: + # CORE FIX: Restored the '-i' flag to force an interactive shell. + # This ensures ~/.bashrc is fully sourced, defining functions and variables. + raw_macros_output = gh.run("bash -c -i 'show-macros-proper'", check=True).splitlines() + except (subprocess.CalledProcessError, FileNotFoundError) as e: + system.exit(f"Error: Could not execute 'show-macros-proper'. Is it in your PATH? Details: {e}", status_code=1) + + macros = set() + for line in raw_macros_output: + stripped_line = line.strip() + if not stripped_line: + continue + + sanitized = my_re.sub(r'\s*\(\)\s*$', '', my_re.sub(r'^\s*function\s+', '', stripped_line)).strip() + # Use the more permissive regex that allows for '.' in names. + if my_re.match(r'^[a-zA-Z0-9_.:-]+$', sanitized): + macros.add(sanitized) + + if not macros: + system.exit("Error: 'show-macros-proper' returned no valid macros after sanitization.", status_code=1) + + debug.trace(TL.DETAILED, f"Sanitized macro list contains {len(macros)} items. Example: {list(macros)[:5]}") + macro_stats = defaultdict(lambda: {'total': 0, 'bad': 0, 'bad_files': set()}) + output_files = self._find_output_files() + if not output_files: + print(f"No output files (*.outputpp.out) found in directory: {self.results_dir}") + return [] + for output_file_str in output_files: + output_file = Path(output_file_str) + base_name = output_file.name.replace('.outputpp.out', '') + source_filename = f"{base_name}.batspp" + try: + content = system.read_file(output_file_str, errors='ignore') + if not content: + continue + snippets = my_re.split(r'\n(?:# Toplevel|={10,})\n', content) + for snippet in snippets: + if not snippet.strip() or not snippet.strip().startswith(('ok', 'not ok')): + continue + is_bad_snippet = snippet.strip().startswith("not ok") + for macro in macros: + if my_re.search(rf'\b{my_re.escape(macro)}\b', snippet): + macro_stats[macro]['total'] += 1 + if is_bad_snippet: + macro_stats[macro]['bad'] += 1 + macro_stats[macro]['bad_files'].add(source_filename) + except IOError as e: + debug.trace(TL.ERROR, f"Could not read {output_file_str}: {e}") + results = [] + for macro, stats in macro_stats.items(): + if stats['total'] > 0: + pct_bad = (stats['bad'] / stats['total']) * 100 + results.append({"macro": macro, "bad": stats['bad'], "total": stats['total'], "pct_bad": pct_bad, "failing_in_files": sorted(list(stats['bad_files']))}) + return sorted(results, key=lambda x: (x['bad'], x['pct_bad']), reverse=True) + + def _write_json_report(self): + """Writes the analysis data to a JSON file.""" + print(f"\nWriting full report to {self.json_filename}...") + if not self.is_heuristic: + output_data = [{"rank": i, "impact_score": data['impact'], "failure_count": data['count'], "affected_files": len(data['sources']), "source_files": sorted(list(data['sources'])), "suspect_command": command} for i, (command, data) in enumerate(self.report_data, 1)] + else: + output_data = self.report_data + try: + json_string = json.dumps(output_data, indent=2) + system.write_file(self.json_filename, json_string) + print("JSON report generated successfully.") + except IOError as e: + system.exit(f"Error: Could not write JSON report to {self.json_filename}: {e}", status_code=1) + + def _print_summary_table(self): + """Prints the formatted summary table to the console.""" + if self.is_heuristic: + print("\n--- Top 20 Suspect Macros/Functions (Sorted by Failure Count) ---") + headers = ['Rank', 'Macro/Function', 'Bad Hits', 'Total Uses', 'Failure Rate', 'Failing In'] + table_data = [] + for i, data in enumerate(self.report_data[:20], 1): + rate_str = f"{data['pct_bad']:.1f}%" + failing_files = data['failing_in_files'] + files_str = "" + if failing_files: + files_to_show = failing_files[:3] + files_str = "\n".join(files_to_show) + if len(failing_files) > 3: + files_str += f"\n(...and {len(failing_files) - 3} more)" + table_data.append([i, data['macro'], data['bad'], data['total'], rate_str, files_str]) + print(tabulate(table_data, headers=headers, tablefmt="fancy_grid", maxcolwidths=[None, None, None, None, None, 45])) + else: + print("\n--- Top 20 Failure Summary (Sorted by Impact) ---") + headers = ['Rank', 'Impact', 'Count', 'Files', 'Suspect Command(s)'] + table_data = [] + for i, (command, data) in enumerate(self.report_data[:20], 1): + table_data.append([i, data['impact'], data['count'], len(data['sources']), command]) + print(tabulate(table_data, headers=headers, tablefmt="fancy_grid", maxcolwidths=[None, None, None, None, 70])) + +# ------------------------------------------------------------------------------ +# Command-Line Interface (CLI) Wrapper +# ------------------------------------------------------------------------------ + +class Script(Main): + """ + Input processing, orchestration, and reporting class. + This class is a thin wrapper around the core FailureAnalyzer logic. + """ + results_dir = "." + json_filename = None + diagnostic_mode = False + heuristic_mode = False + + def setup(self): + """Check results of command line processing and initialize members.""" + debug.trace(TL.VERBOSE, f"Script.setup(): self={self}") + super().setup() + + path_str = self.get_parsed_option(RESULTS_DIR, ".") + abs_path_str = os.path.abspath(path_str) + + if not system.file_exists(abs_path_str): + system.exit(f"Error: Directory '{abs_path_str}' does not exist.", status_code=1) + if not system.is_directory(abs_path_str): + system.exit(f"Error: Path '{abs_path_str}' is not a directory.", status_code=1) + self.results_dir = abs_path_str + + self.diagnostic_mode = self.get_parsed_option(DIAGNOSTIC_MODE, self.diagnostic_mode) + self.heuristic_mode = self.get_parsed_option(HEURISTIC_MODE, self.heuristic_mode) + self.json_filename = self.get_parsed_option(JSON_FILENAME, None) + + debug.trace_object(5, self, label=f"{self.__class__.__name__} instance") + + def run_main_step(self): + """ + Main processing step. Instantiates and runs the FailureAnalyzer. + """ + version = "v18-addon.24" + print(f"Executing {version} analysis on target directory: {self.results_dir}\n") + + analyzer = FailureAnalyzer( + results_dir=self.results_dir, + is_heuristic=self.heuristic_mode, + json_filename=self.json_filename + ) + + analyzer.run() + +def main(): + """Entry point""" + app = Script( + description=__doc__.format(script=gh.basename(__file__)), + manual_input=True, + auto_help=True, + boolean_options=[ + (DIAGNOSTIC_MODE, "Enable diagnostic mode to analyze file content"), + (HEURISTIC_MODE, "Use Tom's macro failure heuristic instead of the default analysis") + ], + text_options=[ + (RESULTS_DIR, "Path to the test results directory"), + (JSON_FILENAME, "Output filename for the JSON report (overrides defaults)") + ], + ) + app.run() + +if __name__ == '__main__': + main() diff --git a/tests/git-aliases-tests-1.ipynb b/tests/git-aliases-tests-1.ipynb index 7a4ee2d7..41d84667 100644 --- a/tests/git-aliases-tests-1.ipynb +++ b/tests/git-aliases-tests-1.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "290fe5a4-8b43-41ae-ac44-969e412d7bdb", "metadata": {}, "outputs": [], @@ -15,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "e460edf9-35b9-44a8-be1f-4ba96544c6d2", "metadata": {}, "outputs": [], @@ -35,7 +35,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "e275e149-a770-4710-ba8c-9923e9c8a686", "metadata": {}, "outputs": [], @@ -48,12 +48,13 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "60a638cf-32a3-4ffa-8d05-67556dfd90a0", "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "# Creating temp local repos to test on\n", "# note: true at end is to avoid stderr status due to rename command failure, which also seems\n", "# to throw off the bash kernel (e.g., leading to halt during run-all-cells)\n", @@ -69,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "e03903bd-04cd-4449-8fc8-009cacf4c728", "metadata": {}, "outputs": [], @@ -87,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "6f0c4d04-271f-469a-82fa-af3b8052f1c6", "metadata": {}, "outputs": [], @@ -101,7 +102,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "53997e78-72db-4a98-b528-7381353ad2e6", "metadata": {}, "outputs": [], @@ -119,7 +120,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "369fd092-8ec5-4f0c-9ad5-83be80c8648f", "metadata": {}, "outputs": [], @@ -132,7 +133,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "3e87355d-a872-4cb6-b293-baed57c08cf7", "metadata": {}, "outputs": [], @@ -147,7 +148,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "b1148a78-dace-4b0e-a4de-6b52638c43e6", "metadata": {}, "outputs": [ @@ -166,7 +167,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "5f4c7df1-df95-48ab-9f71-241a739ec802", "metadata": {}, "outputs": [ @@ -187,7 +188,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "1b77bcde-0382-48bd-ad6c-45bbf2ac46fd", "metadata": {}, "outputs": [ @@ -208,7 +209,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "91bf6993-27ba-4b7e-8556-c1c84b83c3ed", "metadata": {}, "outputs": [ @@ -227,7 +228,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "01ccce52-4164-4370-8c79-85a9e72425ea", "metadata": {}, "outputs": [ @@ -253,7 +254,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "e015f1fb-a1fc-4808-9e2a-8f982122f707", "metadata": {}, "outputs": [ @@ -272,7 +273,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "8839a602-831b-44de-b6f9-f2d79066a708", "metadata": {}, "outputs": [], @@ -289,7 +290,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "4802dbe6-2d1c-4432-b854-2d327d09dc47", "metadata": {}, "outputs": [], @@ -302,7 +303,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "d7086fd9-9bb6-47e2-9abc-3606395a3b1a", "metadata": {}, "outputs": [ @@ -321,7 +322,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "3e8c4f3c-0b58-4a68-b2a4-32b03e46d054", "metadata": {}, "outputs": [ @@ -346,7 +347,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "11ef9fdb-2f90-49fd-8550-595995b21be0", "metadata": {}, "outputs": [ @@ -365,7 +366,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "64e1cc7e-1771-4fe5-a7d0-95b53adccc07", "metadata": {}, "outputs": [], @@ -378,7 +379,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "ef603a0e-c057-4957-9a1b-5bc8c4385d8d", "metadata": {}, "outputs": [ @@ -406,7 +407,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "927d226a-bb68-4120-8078-6a6af0766e28", "metadata": {}, "outputs": [], @@ -418,7 +419,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "2ac0b1dd-2364-4259-a912-fb3527444a6a", "metadata": {}, "outputs": [ @@ -437,7 +438,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "da6aef2f-5e07-4c9d-97bb-d8df6ed6f172", "metadata": {}, "outputs": [], @@ -451,7 +452,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "b3bfb8a7-e4a4-4b5a-8266-473044819572", "metadata": {}, "outputs": [], @@ -462,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "e087d6ef-1cd3-4316-bae4-9d345fb981a7", "metadata": {}, "outputs": [], @@ -473,7 +474,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "9e58a0e1-22c4-4291-832f-34f0620a0768", "metadata": {}, "outputs": [], @@ -488,7 +489,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "de9643d1-05ae-4a0c-b648-a04130aaad2c", "metadata": {}, "outputs": [], diff --git a/tests/git-aliases-tests-2.ipynb b/tests/git-aliases-tests-2.ipynb index b2761dde..fbc80f27 100644 --- a/tests/git-aliases-tests-2.ipynb +++ b/tests/git-aliases-tests-2.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "c4a5e6eb-8fb2-4ae8-9644-2e9b7308003f", "metadata": {}, "outputs": [], @@ -15,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "16f6f349-7b06-4d8c-8043-72b5a4003e5f", "metadata": {}, "outputs": [], @@ -35,12 +35,13 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "9fce46b8-118d-4899-8761-c96fca6af7c7", "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "# Creating temp local repos to test on\n", "# note: true at end is to avoid stderr status due to rename command failure, which also seems\n", "# to throw off the bash kernel (e.g., leading to halt during run-all-cells)\n", @@ -52,7 +53,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "31ebb818-8a7b-41fe-8b41-3c72dbf0c6ea", "metadata": {}, "outputs": [], @@ -63,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "7338b000-2deb-4785-b4eb-20a988f006e9", "metadata": {}, "outputs": [], @@ -84,7 +85,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "7495cba8-cf88-46ab-a0c1-c7256d84da83", "metadata": {}, "outputs": [], @@ -97,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "614c487d-a32f-45d2-838e-87270307187c", "metadata": {}, "outputs": [], @@ -118,7 +119,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "c1353dbf-ed12-4811-989a-542a468ee534", "metadata": {}, "outputs": [ @@ -138,7 +139,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "a196403d-b012-415d-a69c-33a2e68cd0d9", "metadata": {}, "outputs": [ @@ -168,7 +169,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "165c686d-2202-4642-8eee-9a1b245dbf5a", "metadata": { "scrolled": true @@ -190,7 +191,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "352e510f-c581-4fd8-aabd-154420c9eebc", "metadata": {}, "outputs": [], @@ -203,7 +204,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "ff7ac3e7-88e9-4556-984b-47b9b5b0c665", "metadata": {}, "outputs": [ @@ -222,7 +223,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "d59e48e0-e1ce-4800-a3c7-3036a3f1a0e9", "metadata": {}, "outputs": [ @@ -249,7 +250,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "b61ec172-ee7d-4c50-8586-0cf428ce9b5f", "metadata": {}, "outputs": [ @@ -268,7 +269,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "4f7a09e7-c073-4a1a-8a30-1c7d1c72a2ac", "metadata": {}, "outputs": [], @@ -280,7 +281,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "a42bda6d-2234-4dea-b3cb-50bae54ce2ba", "metadata": {}, "outputs": [ @@ -299,7 +300,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "c99820a0-ea49-423f-8f1d-ebf95674ca51", "metadata": {}, "outputs": [ @@ -329,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "d8ba1634-a8a4-4952-b88c-90876299a779", "metadata": {}, "outputs": [ @@ -350,7 +351,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "f1f58cae-5f75-4ef4-ab60-9061cf89728f", "metadata": {}, "outputs": [ @@ -379,7 +380,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "29283995-ca0e-4b72-9eb9-3d8ee5274141", "metadata": {}, "outputs": [ @@ -398,7 +399,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "9d2284eb-bce7-4ecb-af35-33d843c70e34", "metadata": {}, "outputs": [ @@ -417,7 +418,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "379b916e-bcbe-4142-9240-a6a0ef0844fb", "metadata": {}, "outputs": [ @@ -439,7 +440,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "03583297-cf3a-4de2-84ef-72997f529672", "metadata": {}, "outputs": [ @@ -470,7 +471,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "4df4623a-a77d-451f-9f56-0c257cadb6d5", "metadata": {}, "outputs": [], @@ -484,7 +485,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "443ee833-6600-404a-a831-ac32bc929be4", "metadata": {}, "outputs": [ @@ -503,7 +504,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "f361e865-181c-4756-9db7-e8923dde582a", "metadata": {}, "outputs": [], @@ -518,7 +519,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "6f872d76-618e-4a31-ac77-39244f2562f4", "metadata": {}, "outputs": [], @@ -532,7 +533,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "2a7a81a3-7810-4026-a0a4-0093fef7baab", "metadata": {}, "outputs": [], diff --git a/tests/git-aliases-tests-3.ipynb b/tests/git-aliases-tests-3.ipynb index c513fff1..80989115 100644 --- a/tests/git-aliases-tests-3.ipynb +++ b/tests/git-aliases-tests-3.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "6ffab7b3-f985-43c1-b44a-dc8d1ec92be0", "metadata": {}, "outputs": [], @@ -15,7 +15,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "fdb33c4d-1e6d-4b83-ad98-438645545565", "metadata": {}, "outputs": [], @@ -35,7 +35,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "e7c3cec9-aa35-4675-bf8f-ab2e21dacbc4", "metadata": {}, "outputs": [], @@ -46,12 +46,13 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "d041fdf6-f8bb-4fd0-93e1-0d766a9b7f3f", "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "# Creating temp local repos to test on\n", "# note: true at end is to avoid stderr status due to rename command failure, which also seems\n", "# to throw off the bash kernel (e.g., leading to halt during run-all-cells)\n", @@ -63,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "4c9d8477-f41c-4dd2-9f22-54ddd3f5a068", "metadata": {}, "outputs": [], @@ -74,7 +75,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "d0cb7725-29e9-4b43-8787-b7731a958c6b", "metadata": {}, "outputs": [], @@ -95,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "117c1469-13c2-4add-8bcf-dd7e3e311275", "metadata": {}, "outputs": [], @@ -108,7 +109,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "f4181905-de97-4f98-a4be-9a30469cd572", "metadata": {}, "outputs": [], @@ -140,7 +141,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "0625a301-9df1-423f-9b9d-2511374ee950", "metadata": {}, "outputs": [], @@ -154,7 +155,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "173f9f6f-0708-49ed-9743-08e527aa33f0", "metadata": {}, "outputs": [ @@ -174,7 +175,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "42810d73-4062-40a8-98b3-0cc9f98a8bc8", "metadata": {}, "outputs": [], @@ -186,7 +187,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "3000e31c-e5ab-4652-adc8-882a85bf0b56", "metadata": {}, "outputs": [ @@ -206,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "493ef6a9-6793-4408-9b64-fad95baf1e42", "metadata": {}, "outputs": [ @@ -240,7 +241,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "f59cbfad-4468-4db2-8fd7-f0bf001f185c", "metadata": { "scrolled": true @@ -261,7 +262,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "db2d0e87-44a3-47a4-9cf3-756d043b721a", "metadata": {}, "outputs": [], @@ -273,7 +274,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "76999b1d-9922-41a0-8e60-95d8285fbb10", "metadata": {}, "outputs": [], @@ -287,7 +288,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "46dce0df-5f71-4206-9481-faf4082d6557", "metadata": { "scrolled": true @@ -319,7 +320,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "e0b57d7f-17ea-4b3f-9734-636ac3b93693", "metadata": {}, "outputs": [], @@ -331,7 +332,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "0f2027d6-f16e-4906-8815-8c2d9c4935ab", "metadata": {}, "outputs": [ @@ -352,7 +353,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "1f7de086-f57a-401e-b39a-2b5062ce5a65", "metadata": {}, "outputs": [], @@ -366,7 +367,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "b3441cc6-f773-4db2-b233-660a2c51beab", "metadata": {}, "outputs": [], diff --git a/tests/hello-world-basic.ipynb b/tests/hello-world-basic.ipynb index 2ccb132d..d99cc1c8 100644 --- a/tests/hello-world-basic.ipynb +++ b/tests/hello-world-basic.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "a03c1f14", "metadata": { "scrolled": false @@ -10,13 +10,14 @@ "outputs": [], "source": [ "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "bind 'set enable-bracketed-paste off'\n", "## OLD: echo 'BIND ON!' returns assertion failed (unexpected header file)" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "619ceccf", "metadata": {}, "outputs": [ @@ -35,7 +36,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "93dfcf88", "metadata": { "scrolled": true @@ -56,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "adb5fa38", "metadata": {}, "outputs": [ diff --git a/tests/hello-world-revised.ipynb b/tests/hello-world-revised.ipynb index 96d5640e..fd26a9f3 100644 --- a/tests/hello-world-revised.ipynb +++ b/tests/hello-world-revised.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "cc34e95a", "metadata": {}, "outputs": [], @@ -13,12 +13,13 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "220201d8", "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "alias testuser=\"sed -r \"s/\"$USER\"+/userxf333/g\"\"\n", "alias testnum=\"sed -r \"s/[0-9]/N/g\"\"\n", "\n", @@ -28,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "10e4aac0", "metadata": {}, "outputs": [ @@ -46,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "93dfcf88", "metadata": {}, "outputs": [ @@ -64,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "95585f5b", "metadata": {}, "outputs": [ @@ -85,7 +86,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "1c7c7b9a", "metadata": {}, "outputs": [], @@ -95,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "7e5dcc7c", "metadata": {}, "outputs": [ @@ -114,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "a3e68607", "metadata": { "scrolled": true @@ -137,7 +138,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "ec969a63", "metadata": { "scrolled": true @@ -162,7 +163,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "95a43fbc", "metadata": { "scrolled": true @@ -187,7 +188,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "038ec2ec", "metadata": {}, "outputs": [ @@ -206,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "4b05bb35", "metadata": {}, "outputs": [ @@ -226,7 +227,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "ef05beae", "metadata": {}, "outputs": [ diff --git a/tests/hello-world-source.ipynb b/tests/hello-world-source.ipynb index 6c285e6c..6b4bc72c 100644 --- a/tests/hello-world-source.ipynb +++ b/tests/hello-world-source.ipynb @@ -2,33 +2,33 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "0d3585e8", "metadata": {}, "outputs": [], "source": [ - "function count-aliases { alias | wc -l; }\n", "## OLD (AND BAD MAYBE?)\n", "# function clear-aliases { unalias -a; }" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "34d3ee50", "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", - "\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "## NEW\n", + "function count-aliases { alias | wc -l; }\n", "alias testuser=\"sed -r \"s/\"$USER\"+/userxf333/g\"\"\n", "alias testnum=\"sed -r \"s/[0-9]/N/g\"\" " ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "c28b2baf", "metadata": {}, "outputs": [ @@ -48,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "28fbc81f", "metadata": {}, "outputs": [], @@ -61,7 +61,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ec98d1a1", "metadata": {}, "outputs": [], @@ -77,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "3bf78d9a", "metadata": {}, "outputs": [], @@ -88,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "4fea4a3e", "metadata": {}, "outputs": [ @@ -106,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "c20e6d75", "metadata": {}, "outputs": [ @@ -130,7 +130,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "6ac91d4b", "metadata": {}, "outputs": [], @@ -140,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "17bce77c", "metadata": {}, "outputs": [ diff --git a/tests/json-related-alias.ipynb b/tests/json-related-alias.ipynb index 5d082b15..ecb2b224 100644 --- a/tests/json-related-alias.ipynb +++ b/tests/json-related-alias.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "3d3ddf65-8036-4923-ac32-45f5d98e91e6", "metadata": {}, "outputs": [], @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "f4eebb4d-93e2-4c21-b0e5-13b1914fa0d7", "metadata": {}, "outputs": [], @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "f98b217c-248e-4b31-ac94-680d7ce9167e", "metadata": {}, "outputs": [], @@ -63,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "6606f75c-a15b-48d9-9c55-5fac8d45d86e", "metadata": {}, "outputs": [], @@ -80,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "0ff295df", "metadata": {}, "outputs": [], @@ -95,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "503cf120", "metadata": {}, "outputs": [], @@ -111,7 +111,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "87325c19", "metadata": {}, "outputs": [ @@ -124,7 +124,8 @@ } ], "source": [ - "# Global setup\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "## NOTE: For reproducability, the directory name needs to be fixed\n", "## In place of $$, use a psuedo random number (e,g., 1210)\n", "## *** All output from one run to the next needs to be the same ***\n", @@ -156,7 +157,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "9a135b2b", "metadata": {}, "outputs": [], @@ -172,7 +173,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "2b788ea0", "metadata": {}, "outputs": [], @@ -186,7 +187,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "6c08163d", "metadata": {}, "outputs": [], @@ -197,7 +198,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "924902bb-0a88-4288-a77b-befb0059313b", "metadata": {}, "outputs": [], @@ -210,7 +211,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "e5887c23-9a4d-4c13-b844-08668c53c942", "metadata": {}, "outputs": [ @@ -243,7 +244,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "b7b6e740-f9f6-41eb-8482-064187c8e45e", "metadata": {}, "outputs": [ @@ -263,7 +264,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "834867c4-d235-4c77-9123-a3455917416c", "metadata": {}, "outputs": [ @@ -311,7 +312,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "6e461b80-7a92-498c-a110-a714ea1df5e6", "metadata": {}, "outputs": [ @@ -331,7 +332,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "288799b9-a0f3-4540-9145-b8bfa63dc2b1", "metadata": {}, "outputs": [ @@ -354,7 +355,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "fad52445-44fa-4dd8-84d9-faa014a8a3b4", "metadata": {}, "outputs": [ @@ -373,7 +374,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "007989e8-1b37-43c3-a371-41e1f179088b", "metadata": {}, "outputs": [ @@ -392,7 +393,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "c9e9e47c-3c76-47b5-bd8c-96fba12df59c", "metadata": {}, "outputs": [], @@ -407,7 +408,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "d1e269cf", "metadata": { "scrolled": true @@ -419,7 +420,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "5afed100", "metadata": {}, "outputs": [], @@ -438,7 +439,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "2d80e9a2-8abc-4f1c-b1e7-02d30f9d189b", "metadata": {}, "outputs": [ @@ -469,7 +470,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "4e90cda8-b46b-4723-b81e-936184e7ac9f", "metadata": {}, "outputs": [ @@ -493,7 +494,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "5dfaf200-acf0-4b93-a3fc-f7d88a763746", "metadata": {}, "outputs": [ @@ -512,7 +513,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "41667376-26de-4bc8-a363-a0e3b041b76d", "metadata": {}, "outputs": [ @@ -535,7 +536,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "40f93411-77b6-42f6-a8a4-6bc607692660", "metadata": {}, "outputs": [ @@ -554,7 +555,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "aa26c75f", "metadata": {}, "outputs": [ @@ -574,7 +575,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "a64d2b6c-16ce-477c-a8b5-5a4920daa295", "metadata": {}, "outputs": [ @@ -593,7 +594,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "7b4e1f9f-1038-439c-b30f-428af855c53e", "metadata": {}, "outputs": [ @@ -617,7 +618,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "67b91bef-c18f-4acf-b269-824909eef00c", "metadata": {}, "outputs": [ @@ -636,7 +637,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "8648f684-f32c-42d1-9133-d080e1e31058", "metadata": {}, "outputs": [ @@ -660,7 +661,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "23304c50-b412-4bfa-8646-dcc22e1d0aa2", "metadata": {}, "outputs": [ @@ -679,7 +680,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "a3b91159-fc02-434b-9fd9-ab3109023d21", "metadata": {}, "outputs": [ @@ -703,7 +704,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "5ee58759-a547-455d-aba0-7b28c7cea681", "metadata": {}, "outputs": [ @@ -722,7 +723,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "80c1fca1-4f38-4510-b122-8b8bbbeadbf7", "metadata": {}, "outputs": [ @@ -746,7 +747,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "2bcad8e0-8a08-4abc-a2dc-7462469208e1", "metadata": { "scrolled": true @@ -768,7 +769,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "7f9b05b1-4ce9-449b-ab24-aa0bd9e45d26", "metadata": { "scrolled": true @@ -789,7 +790,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "id": "7d03d39c-e43a-4a6f-ad02-9eefe5e1a4db", "metadata": { "scrolled": true @@ -806,7 +807,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "32d94e3e-c440-424c-a8d0-5aaa82205b94", "metadata": { "scrolled": true @@ -837,7 +838,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "id": "c6d95d7d-1f79-48be-9662-9f947a8b4e60", "metadata": {}, "outputs": [ @@ -863,7 +864,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "id": "b1061edc-a3d4-4e76-af81-e2bf81bd1b45", "metadata": {}, "outputs": [ @@ -886,7 +887,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "id": "09d321bf-3719-4a53-b52e-8523724bc30a", "metadata": {}, "outputs": [ @@ -904,7 +905,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": null, "id": "e41ad3b8", "metadata": {}, "outputs": [ diff --git a/tests/more-tomohara-aliases-test.ipynb b/tests/more-tomohara-aliases-test.ipynb index 0499b6db..23036498 100644 --- a/tests/more-tomohara-aliases-test.ipynb +++ b/tests/more-tomohara-aliases-test.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -11,11 +11,12 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "## TEST: cd /usr/local/misc/programs/bash/shell-scripts-aviyan/tests\n", "## For number of digits not being critical\n", "alias testnum=\"sed -r \"s/[0-9][0-9]*/N/g\"\"\n", @@ -24,7 +25,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -41,7 +42,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -67,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -77,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -87,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -106,7 +107,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -117,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -126,7 +127,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -143,7 +144,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -160,7 +161,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -171,7 +172,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": { "scrolled": true }, @@ -183,7 +184,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -200,7 +201,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, "outputs": [ { diff --git a/tests/perl-script-NOBATSPP.ipynb b/tests/perl-script-NOBATSPP.ipynb index 78c3c2cc..863898d7 100644 --- a/tests/perl-script-NOBATSPP.ipynb +++ b/tests/perl-script-NOBATSPP.ipynb @@ -2,17 +2,19 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "0374d8f3", "metadata": {}, "outputs": [], "source": [ - "# Tests for various perl scripts\n" + "# Tests for various perl scripts\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "9ba9f685", "metadata": {}, "outputs": [], @@ -22,7 +24,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "8e96a185", "metadata": {}, "outputs": [ @@ -41,7 +43,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "9eefccdb", "metadata": {}, "outputs": [], @@ -54,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "9002fc4e", "metadata": {}, "outputs": [], @@ -67,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "33dc7704", "metadata": {}, "outputs": [ @@ -85,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "97ee6ff5", "metadata": {}, "outputs": [ @@ -103,7 +105,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "fc3e1a30", "metadata": {}, "outputs": [], @@ -114,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "7a3290c6", "metadata": {}, "outputs": [], @@ -124,7 +126,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "ddc2ed39", "metadata": {}, "outputs": [ @@ -147,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "f3809b0d", "metadata": {}, "outputs": [ @@ -173,7 +175,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "6a02ab44", "metadata": {}, "outputs": [ @@ -199,7 +201,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "78835b5f", "metadata": {}, "outputs": [], @@ -211,7 +213,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "be5b1b3e", "metadata": {}, "outputs": [ @@ -230,7 +232,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "ab08750a", "metadata": {}, "outputs": [], @@ -242,7 +244,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "6ca3feef", "metadata": {}, "outputs": [ @@ -260,7 +262,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "48a4d4a9", "metadata": {}, "outputs": [], @@ -271,7 +273,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "baf729eb", "metadata": {}, "outputs": [ @@ -290,7 +292,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "4a04766f", "metadata": {}, "outputs": [ diff --git a/tests/simple-alias-test.ipynb b/tests/simple-alias-test.ipynb index 672d53cb..a33ac025 100644 --- a/tests/simple-alias-test.ipynb +++ b/tests/simple-alias-test.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -11,17 +11,18 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "alias count-words='wc -w'" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [ { diff --git a/tests/sudocommentstest-NOBATSPP.ipynb b/tests/sudocommentstest-NOBATSPP.ipynb index 0694cb97..2dda9242 100644 --- a/tests/sudocommentstest-NOBATSPP.ipynb +++ b/tests/sudocommentstest-NOBATSPP.ipynb @@ -2,7 +2,22 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, + "id": "a77626bd", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [], + "source": [ + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" + ] + }, + { + "cell_type": "code", + "execution_count": null, "id": "db4a4325", "metadata": {}, "outputs": [], @@ -12,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "08675bb1", "metadata": {}, "outputs": [], @@ -22,7 +37,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "0ddae0b1", "metadata": { "scrolled": true diff --git a/tests/tar-aliases-tests.ipynb b/tests/tar-aliases-tests.ipynb index b71cd8e4..5ef4f077 100644 --- a/tests/tar-aliases-tests.ipynb +++ b/tests/tar-aliases-tests.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "0cdca65b-a245-4813-8168-54bfbf4fde82", "metadata": {}, "outputs": [], @@ -15,13 +15,13 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "182169ec-5945-4e57-87a6-5afaa1d55a8f", "metadata": {}, "outputs": [], "source": [ - "#Global Setup\n", - "\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "TMP=/tmp/temp-aliases-test\n", "TAR_TEMP=$HOME/temp/tarFolder\n", "\n", @@ -33,7 +33,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "ae699859-8c71-4b52-93dd-ea71de976eba", "metadata": {}, "outputs": [], @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "de060e84-bdba-4781-b832-5765cac56c70", "metadata": { "scrolled": true @@ -64,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ec15a7ed-8f58-472e-b30d-5a1aefa49dba", "metadata": {}, "outputs": [ @@ -84,7 +84,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "dfd24c00-e62e-4b30-9f16-750680c78b1b", "metadata": {}, "outputs": [], @@ -98,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "602759a8-5389-4ead-8c91-66946a716fc2", "metadata": {}, "outputs": [ @@ -118,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "cd459dbc-8af8-4435-a755-31fd916cb8ab", "metadata": {}, "outputs": [], @@ -132,7 +132,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "d3ddf72c-3947-475d-8324-0fd4fa0d1eb1", "metadata": {}, "outputs": [ @@ -152,7 +152,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "abc71837-f5f8-48dc-b23a-34daad400cc2", "metadata": {}, "outputs": [], @@ -166,7 +166,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "07cc0b64-d282-441f-8fad-61fde42a500b", "metadata": {}, "outputs": [ @@ -187,7 +187,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "f4b7bf34-cd65-49ac-b94d-088d1cc8dd52", "metadata": {}, "outputs": [ @@ -209,7 +209,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "5a9088c6-a713-4272-a802-ee3bb969c432", "metadata": {}, "outputs": [], @@ -223,7 +223,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "0a4bb5be-d1f3-44e5-b128-e1bc3bc17917", "metadata": {}, "outputs": [ @@ -243,7 +243,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "95c7e282-2241-4ccb-8180-c8ac6b4b68e1", "metadata": {}, "outputs": [ @@ -265,7 +265,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "6f34b58d-df0b-43db-a796-97ac41027ccc", "metadata": {}, "outputs": [ @@ -285,7 +285,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "16e15ebc-52c3-4e4a-9d6f-e17093cc5a4a", "metadata": {}, "outputs": [], @@ -300,7 +300,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "55b3fdef-e68b-4da5-b279-1d025f9adbc6", "metadata": {}, "outputs": [ @@ -318,7 +318,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "aa6ec678-8491-4031-aa53-06422bba4df1", "metadata": {}, "outputs": [], @@ -331,7 +331,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "1dc5b250-ecfc-4391-93de-3b454986aeb3", "metadata": {}, "outputs": [ @@ -353,7 +353,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "96e186b1-dd48-4313-a3a7-68e20c43c61a", "metadata": {}, "outputs": [], @@ -369,7 +369,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "aca72473-19e0-44bd-9878-dd42daa2bfb6", "metadata": {}, "outputs": [ @@ -389,7 +389,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "d2ccfa66-f8ab-4a0e-b4a5-cfaa4dce797e", "metadata": {}, "outputs": [], @@ -403,7 +403,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "e4d4d958-8cd3-47a5-a0c6-8bb88e8de3bf", "metadata": {}, "outputs": [ @@ -423,7 +423,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "753cf7e4-a746-4ba9-b4b0-822ea7a578a0", "metadata": {}, "outputs": [ @@ -446,7 +446,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "13cc153b-e2bb-44d9-87b9-b0968d51fc8b", "metadata": {}, "outputs": [ @@ -465,7 +465,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "28413367-1f5a-4d55-962b-622ee4d2a482", "metadata": {}, "outputs": [ @@ -486,7 +486,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "d12fb4a4-bcef-4cb5-bbcd-6d062707f479", "metadata": {}, "outputs": [ @@ -505,7 +505,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "4f7cfbe9-30b3-49eb-b3b1-c8612eb13786", "metadata": {}, "outputs": [], @@ -521,7 +521,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "d7ac6bc3-f604-41a3-ba57-c2f7cfd38659", "metadata": {}, "outputs": [ @@ -539,7 +539,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "1d965a97-0aaf-4ea8-a408-c2bd90debbe6", "metadata": {}, "outputs": [ @@ -567,7 +567,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "3dec9e16-44c4-44a8-b583-4c8dd4e8e4c6", "metadata": {}, "outputs": [ @@ -586,7 +586,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "69cebd84-bdf9-41a2-9511-7e89ceae381f", "metadata": {}, "outputs": [ @@ -614,7 +614,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "6a69d878-d423-4bbe-a2db-8a94f65faa75", "metadata": {}, "outputs": [ @@ -634,7 +634,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "97fcf8b5-bcb4-4a04-8444-41a7e2e7ccc7", "metadata": {}, "outputs": [], @@ -648,7 +648,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "594db337-c51a-41fd-a891-fe861d5f8f08", "metadata": {}, "outputs": [ @@ -667,7 +667,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "3322df5c-d157-4f81-8406-e4e445f49d90", "metadata": {}, "outputs": [ @@ -692,7 +692,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "id": "8f10a396-6085-4c7e-bd1b-3acc8e7c528d", "metadata": {}, "outputs": [ @@ -711,7 +711,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "669fe68a-5ce1-4f7b-b61b-656e499b7211", "metadata": {}, "outputs": [ diff --git a/tests/test-check-errors.ipynb b/tests/test-check-errors.ipynb index 9c795a3e..d7e97de6 100644 --- a/tests/test-check-errors.ipynb +++ b/tests/test-check-errors.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "a8eacedb", "metadata": { "scrolled": true @@ -14,12 +14,15 @@ "## $ echo 'Hi'\n", "## | Hi?2004l\n", "\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "ab1de4e1", "metadata": {}, "outputs": [ @@ -45,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "f2fdf1c6", "metadata": {}, "outputs": [], @@ -60,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "d1c92493", "metadata": {}, "outputs": [ @@ -84,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "da176b40", "metadata": {}, "outputs": [], @@ -120,7 +123,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "eb29a5b2", "metadata": {}, "outputs": [], @@ -135,7 +138,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "9de59cca", "metadata": { "scrolled": true @@ -158,7 +161,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "9abcb30c", "metadata": { "scrolled": true @@ -182,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "f965b950", "metadata": {}, "outputs": [ @@ -209,7 +212,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "1f464ae8", "metadata": {}, "outputs": [ @@ -229,7 +232,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "91d951af", "metadata": {}, "outputs": [], @@ -240,7 +243,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "5705f9dd", "metadata": {}, "outputs": [], @@ -251,7 +254,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "3ff3937e", "metadata": {}, "outputs": [], @@ -262,7 +265,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "46dcd2c5", "metadata": {}, "outputs": [ @@ -288,7 +291,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "e73248ec", "metadata": {}, "outputs": [], @@ -307,7 +310,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "d723b6ec", "metadata": { "scrolled": true @@ -330,7 +333,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "828f82f8", "metadata": {}, "outputs": [ @@ -349,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "51a64432", "metadata": {}, "outputs": [], @@ -366,7 +369,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "afaeaab6", "metadata": {}, "outputs": [ @@ -387,7 +390,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "3d58ae0d", "metadata": {}, "outputs": [ @@ -406,7 +409,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "022992db", "metadata": {}, "outputs": [ @@ -432,7 +435,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "6ed93bf4", "metadata": {}, "outputs": [ @@ -451,7 +454,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "16dbbf36", "metadata": {}, "outputs": [], @@ -479,7 +482,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "664a28ac", "metadata": { "scrolled": true @@ -512,7 +515,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "b200bada", "metadata": {}, "outputs": [ @@ -535,7 +538,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "f8a387ac", "metadata": {}, "outputs": [ diff --git a/tests/test-cond-env-setting.ipynb b/tests/test-cond-env-setting.ipynb index d4c0397e..ad845dae 100644 --- a/tests/test-cond-env-setting.ipynb +++ b/tests/test-cond-env-setting.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "1a928559", "metadata": {}, "outputs": [], @@ -12,12 +12,15 @@ "## Example: \n", "## $ echo 'Hii'\n", "## | Hi?2004l\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "93ec4a3f", "metadata": {}, "outputs": [ @@ -42,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "c6ffbc59", "metadata": {}, "outputs": [], @@ -58,7 +61,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "452a278e", "metadata": {}, "outputs": [], @@ -71,7 +74,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "233f11ac", "metadata": {}, "outputs": [], @@ -90,7 +93,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "be943c71", "metadata": {}, "outputs": [ @@ -137,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "a67f36df", "metadata": {}, "outputs": [ @@ -157,7 +160,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "c39f70a7", "metadata": {}, "outputs": [ @@ -177,7 +180,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "e54c2879", "metadata": {}, "outputs": [], @@ -188,7 +191,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "bb9f1941", "metadata": {}, "outputs": [ @@ -209,7 +212,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "a59bf7fd", "metadata": { "scrolled": true @@ -233,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "3d1256f7", "metadata": { "scrolled": true @@ -258,7 +261,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "3bb906ad", "metadata": {}, "outputs": [], @@ -269,7 +272,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "4f67b1aa", "metadata": {}, "outputs": [ diff --git a/tests/test-dir-alias.ipynb b/tests/test-dir-alias.ipynb index b514091c..111a7541 100644 --- a/tests/test-dir-alias.ipynb +++ b/tests/test-dir-alias.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "49caebb2", "metadata": {}, "outputs": [], @@ -12,12 +12,14 @@ "## Example: \n", "## $ echo 'Hii'\n", "## | Hi?2004l\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "bf51aad6", "metadata": {}, "outputs": [ @@ -45,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "51f6221f", "metadata": {}, "outputs": [], @@ -58,7 +60,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "a52f6603", "metadata": {}, "outputs": [], @@ -74,7 +76,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "025265a3", "metadata": {}, "outputs": [], @@ -101,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "e6048986", "metadata": {}, "outputs": [ @@ -124,7 +126,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "4617f706", "metadata": {}, "outputs": [ @@ -147,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "a83d74be", "metadata": {}, "outputs": [ @@ -187,7 +189,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "2cf5e78c", "metadata": {}, "outputs": [], @@ -205,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "03acd9e4", "metadata": {}, "outputs": [], @@ -227,7 +229,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "ea266c6d", "metadata": {}, "outputs": [ @@ -249,7 +251,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "f6a81cd1", "metadata": {}, "outputs": [], @@ -261,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "de07d2f9", "metadata": {}, "outputs": [ @@ -281,7 +283,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "8cdb8526", "metadata": { "scrolled": true @@ -299,7 +301,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "c56d7627", "metadata": {}, "outputs": [], @@ -310,7 +312,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "d349511a", "metadata": {}, "outputs": [ @@ -352,7 +354,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "75b34acf", "metadata": {}, "outputs": [ @@ -371,7 +373,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "fe083afe", "metadata": {}, "outputs": [], @@ -384,7 +386,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "92e3158b", "metadata": {}, "outputs": [ @@ -403,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "b84ff56c", "metadata": {}, "outputs": [], @@ -416,7 +418,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "e867fdf5", "metadata": {}, "outputs": [], @@ -427,7 +429,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "18d748bf", "metadata": {}, "outputs": [], @@ -439,7 +441,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "45c7253b", "metadata": {}, "outputs": [ @@ -461,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "0aec5836", "metadata": {}, "outputs": [ @@ -483,7 +485,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "b4742a89", "metadata": { "scrolled": true diff --git a/tests/test-eval-condition-alias.ipynb b/tests/test-eval-condition-alias.ipynb index 7a9b1835..84ce1572 100644 --- a/tests/test-eval-condition-alias.ipynb +++ b/tests/test-eval-condition-alias.ipynb @@ -2,7 +2,21 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [], + "source": [ + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" + ] + }, + { + "cell_type": "code", + "execution_count": null, "metadata": { "vscode": { "languageId": "shellscript" @@ -24,7 +38,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": { "vscode": { "languageId": "shellscript" @@ -46,7 +60,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": { "vscode": { "languageId": "shellscript" @@ -69,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": { "vscode": { "languageId": "shellscript" diff --git a/tests/test-tomohara-aliases-access.ipynb b/tests/test-tomohara-aliases-access.ipynb index 8f19d793..ff131420 100644 --- a/tests/test-tomohara-aliases-access.ipynb +++ b/tests/test-tomohara-aliases-access.ipynb @@ -2,7 +2,21 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [], + "source": [ + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" + ] + }, + { + "cell_type": "code", + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -11,7 +25,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -30,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -41,7 +55,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -60,7 +74,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "scrolled": true }, @@ -83,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -101,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ diff --git a/tests/test-tomohara-proper-aliases.ipynb b/tests/test-tomohara-proper-aliases.ipynb index a348692f..308a22ba 100644 --- a/tests/test-tomohara-proper-aliases.ipynb +++ b/tests/test-tomohara-proper-aliases.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "7ae74a7f-143d-4601-ade2-8eb7560414f2", "metadata": {}, "outputs": [], @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "9ed2ea02-d24e-46c8-b7a5-12ba9fb3823f", "metadata": {}, "outputs": [], @@ -40,12 +40,14 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "f222e081-05a9-40f7-bba2-c1c1085fa874", "metadata": {}, "outputs": [], "source": [ - "# Global setup\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", + "source ~/shell-scripts/tomohara-proper-aliases.bash\n", "TMP=${TMP:-/tmp}\n", "temp_dir=\"$TMP/test-tomohara-proper-aliases\"\n", "rename-with-file-date \"$temp_dir\" > /dev/null\n", @@ -55,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "712237b1-61f6-46cd-8d1b-c71b971fc456", "metadata": {}, "outputs": [], @@ -66,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "1cab18b9-2bfd-4b23-b469-52f57affb890", "metadata": {}, "outputs": [ @@ -86,7 +88,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "f06e6cb3-27da-424a-96ac-db6a541e5eea", "metadata": {}, "outputs": [ @@ -104,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "407f4682-81cf-4cab-a7ee-75393b59f599", "metadata": {}, "outputs": [], @@ -148,7 +150,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "46d0cf6d-c6ba-4a43-8dcb-0cdb1612b72a", "metadata": {}, "outputs": [ @@ -170,7 +172,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "fc6efda3-db35-461c-94c8-3a4c01e28c63", "metadata": {}, "outputs": [ @@ -188,7 +190,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "71263425-b9f3-4263-9fae-239e8b098010", "metadata": {}, "outputs": [ @@ -206,7 +208,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "c1c83605-bcea-47ae-bb7c-c5f28794b98b", "metadata": {}, "outputs": [ @@ -226,7 +228,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "162824fc-d4aa-4b1d-aeeb-a205a1dd3252", "metadata": {}, "outputs": [ @@ -248,7 +250,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "52f96858-8b1d-4f77-bdf7-c1b6495f533a", "metadata": {}, "outputs": [ @@ -266,7 +268,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "8859f484-2415-4443-9a46-39515b807ca6", "metadata": {}, "outputs": [ @@ -284,7 +286,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "7939b958-d616-4501-8bc0-5fc6bbb01538", "metadata": {}, "outputs": [ @@ -309,7 +311,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "348c12f8-7816-4263-9bfe-012fc9388a35", "metadata": {}, "outputs": [ @@ -327,7 +329,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "ad18859b-26b5-4d9c-9521-94d379ea8144", "metadata": {}, "outputs": [ @@ -345,7 +347,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "044c2903-1a2f-49c1-ad7a-08820edd0770", "metadata": {}, "outputs": [], @@ -355,7 +357,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "02071fd5-5c5a-4b2c-8348-dedb7e6e4266", "metadata": {}, "outputs": [ @@ -373,7 +375,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "afc4e4a7-4b8a-4ae0-9329-6e90e6289293", "metadata": {}, "outputs": [], @@ -402,7 +404,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "328bb4eb-c58f-4814-845a-12b2e18bbf7f", "metadata": {}, "outputs": [], @@ -414,7 +416,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "8cf5cdce-3bb0-4e31-b7f8-e6543520bd89", "metadata": { "scrolled": true @@ -435,7 +437,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "9fbc99ce-0a8d-4acc-97b0-fab813cb5c63", "metadata": {}, "outputs": [ @@ -453,7 +455,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "2e44729a-fff0-46b4-b93e-b0955efeede3", "metadata": {}, "outputs": [], @@ -478,7 +480,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "ee432c11-3a49-4a7c-956a-e41c1465daa0", "metadata": {}, "outputs": [], @@ -490,7 +492,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "ca99ee7a-4b84-467e-bc09-4df09ed91107", "metadata": {}, "outputs": [ diff --git a/tests/testbook-test-dir-aliases.ipynb b/tests/testbook-test-dir-aliases.ipynb index 29c4bfe3..0e8ee583 100644 --- a/tests/testbook-test-dir-aliases.ipynb +++ b/tests/testbook-test-dir-aliases.ipynb @@ -2,18 +2,19 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "396f0ead", "metadata": {}, "outputs": [], "source": [ - "# Setup\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "bind 'set enable-bracketed-paste off'" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "92562e76", "metadata": {}, "outputs": [], @@ -27,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "4d95b977", "metadata": {}, "outputs": [], @@ -44,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "6f63b1f0", "metadata": {}, "outputs": [], @@ -58,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "4c3ef9bf", "metadata": {}, "outputs": [ @@ -78,7 +79,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "e5e5198f", "metadata": {}, "outputs": [ @@ -98,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "06e018f7", "metadata": {}, "outputs": [], @@ -121,7 +122,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "4174903c", "metadata": {}, "outputs": [ @@ -140,7 +141,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "a5bccfa0", "metadata": {}, "outputs": [ @@ -172,7 +173,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "2da846ab", "metadata": {}, "outputs": [ @@ -192,7 +193,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "877ba109", "metadata": {}, "outputs": [], @@ -205,7 +206,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "9f2086a4", "metadata": {}, "outputs": [ @@ -226,7 +227,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "76653eee", "metadata": {}, "outputs": [], @@ -240,7 +241,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "8a876ed2", "metadata": {}, "outputs": [], @@ -251,7 +252,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "d453b321", "metadata": {}, "outputs": [], @@ -263,7 +264,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "12691464", "metadata": {}, "outputs": [], @@ -274,7 +275,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "f93f05f0", "metadata": {}, "outputs": [ @@ -293,7 +294,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "f2558170", "metadata": {}, "outputs": [ @@ -315,7 +316,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "0951b468", "metadata": {}, "outputs": [ @@ -334,7 +335,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "396bb3de", "metadata": {}, "outputs": [ @@ -356,7 +357,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "eefe859d", "metadata": {}, "outputs": [], @@ -368,7 +369,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "6952c36b", "metadata": {}, "outputs": [], @@ -381,7 +382,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "42c6c019", "metadata": {}, "outputs": [], @@ -393,7 +394,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "c70cdbce", "metadata": { "scrolled": true @@ -414,7 +415,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "ce67e2e4", "metadata": {}, "outputs": [ @@ -435,7 +436,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "eafc7375", "metadata": {}, "outputs": [ diff --git a/tests/testing-support-script-tests.ipynb b/tests/testing-support-script-tests.ipynb index c16c50e3..d3da6ebf 100644 --- a/tests/testing-support-script-tests.ipynb +++ b/tests/testing-support-script-tests.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "7cb29952-f87f-4874-bb8e-9416fcdf3827", "metadata": {}, "outputs": [], @@ -12,18 +12,19 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "c071734b-2447-4d61-883a-cfe6b0a3001e", "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "# TODO" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "286f9780-c223-4eab-b57a-f593efe59d3b", "metadata": {}, "outputs": [], @@ -34,7 +35,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "ddfd9f55-9a4d-49be-8de7-cced0d1bf3fc", "metadata": {}, "outputs": [ @@ -55,7 +56,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "477cf63b-2675-4e54-ba4c-4a6e91be5f14", "metadata": {}, "outputs": [], @@ -66,7 +67,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "9911adb1-b9f6-44a4-a820-0afdaea2cc52", "metadata": {}, "outputs": [ @@ -86,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "e96fd637-4ca4-4f8f-a939-8e91d0135596", "metadata": {}, "outputs": [], @@ -97,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "a32d21fc-11e0-4204-9b59-f891f397ba27", "metadata": {}, "outputs": [ @@ -118,7 +119,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "a8d93dcb-c2ad-4fcd-9fad-9ec2633dadc0", "metadata": {}, "outputs": [ @@ -137,7 +138,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "6c110d76-9927-4bb9-8c6c-ed7ba76db9a1", "metadata": {}, "outputs": [ @@ -156,7 +157,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "e2289fa3-4545-45a6-aa02-f8a1ac7864f6", "metadata": {}, "outputs": [ diff --git a/tests/testing-tips.ipynb b/tests/testing-tips.ipynb index adc336fe..ddb27ba4 100644 --- a/tests/testing-tips.ipynb +++ b/tests/testing-tips.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "6e4f0bbd-bf91-4477-a0c0-0450bbbd822b", "metadata": {}, "outputs": [], @@ -60,12 +60,13 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "5718e26a-1a98-49e6-a106-5c8131bcd23e", "metadata": {}, "outputs": [], "source": [ "# Global setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "# Note: Put any helper aliases for your tests here\n", "alias current-time-in-seconds='date +%s'\n", "alias num-sleep-processes='ps | grep sleep | wc -l'" @@ -73,7 +74,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "364865f3-373c-4446-ad7d-3f32ec5607ef", "metadata": {}, "outputs": [], @@ -83,7 +84,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "a65eaae5-8a3b-4dfa-8b03-3f8f20e2c2af", "metadata": {}, "outputs": [], @@ -99,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "d23fe0ea-0688-45d2-8540-1bcc2f3ccdf8", "metadata": {}, "outputs": [ @@ -123,7 +124,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "b3acca49-d755-4be0-9dbb-2ceb7c20d928", "metadata": {}, "outputs": [], @@ -136,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "976112a2-7110-4c92-b711-9db7cec9c8b4", "metadata": {}, "outputs": [ @@ -154,7 +155,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "1d057acd-ef39-41d6-9947-64aa86553062", "metadata": {}, "outputs": [ @@ -173,7 +174,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "b967dc5c-efd6-4064-b8e6-06d84addf013", "metadata": {}, "outputs": [], @@ -190,7 +191,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "19170b73-8b6c-4ba0-adba-886cf53d0e9d", "metadata": {}, "outputs": [ @@ -209,7 +210,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "7d73bba8-1441-477b-97b0-840cf957a667", "metadata": {}, "outputs": [ @@ -228,7 +229,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "fe6b050f-cb69-4b2c-9014-de63c9204227", "metadata": {}, "outputs": [ @@ -247,7 +248,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "cfb14e20-9146-4582-bdc6-078b8dac7956", "metadata": {}, "outputs": [ @@ -267,7 +268,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "82ec583b-381d-4528-ae2b-283b64556b29", "metadata": {}, "outputs": [ diff --git a/tests/tests/test_failure_analyzer.py b/tests/tests/test_failure_analyzer.py new file mode 100644 index 00000000..b47bd92c --- /dev/null +++ b/tests/tests/test_failure_analyzer.py @@ -0,0 +1,264 @@ +#! /usr/bin/env python3 +# +# Test(s) for ../failure_analyzer.py +# +# Notes: +# - This is a test of the module, not the test template. +# - This can be run as follows: +# $ PYTHONPATH=".:$PYTHONPATH" python ./mezcla/tests/test_failure_analyzer.py +# +# +# WAR STORIES & LESSONS LEARNED FROM DEBUGGING: +# --------------------------------------------- +# This test suite was hardened through several rounds of debugging. Here are the +# key takeaways that are now enshrined in our testing patterns: +# +# - NO MOCKING LIBRARIES: To test interactions with external commands, we use +# the "PATH Trick" instead of mocking libraries, ensuring we test the true +# execution path. +# +# - CLI PATHS MUST BE ABSOLUTE: Subprocesses can't resolve relative paths, so +# we always pass absolute paths to the script using `system.absolute_path()`. +# +# - REFACTOR FOR DRY (Don't Repeat Yourself): The initial CLI and API tests +# had repetitive setup code. This was refactored by creating helper methods +# (`helper_get_analyzer`, `helper_run_analyzer_cli`) to encapsulate common +# actions, making each test simpler and more focused on its specific inputs and +# assertions. This follows the KISS principle. +# + +""" +Tests for the failure_analyzer module, using a strict "no-mock" policy for +testing external command interactions. +""" + +# Standard packages +import shutil +import os +import json +import pytest + +# Local packages +from mezcla.unittest_wrapper import TestWrapper, invoke_tests +from mezcla import debug +from mezcla import system + +# Note: Two references are used for the module to be tested: +# THE_MODULE: global module object +import failure_analyzer as THE_MODULE + + +class TestFailureAnalyzer(TestWrapper): + """Class for testcase definition, following the 'mezcla' testing style.""" + script_file = TestWrapper.get_module_file_path(__file__) + script_module = TestWrapper.get_testing_module_name(__file__, THE_MODULE) + use_temp_base_dir = True + python_exe = "python3" + + def setUp(self): + """Set up a clean temporary directory for each test.""" + super().setUp() + if system.file_exists(self.temp_base): + shutil.rmtree(self.temp_base) + system.create_directory(self.temp_base) + + def helper_setup_mock_bin_and_env(self, script_content: str, exit_code: int = 0) -> str: + """Creates a fake 'show-macros-proper' and returns the PATH env var.""" + mock_bin_dir = system.form_path(self.temp_base, "mock_bin") + system.create_directory(mock_bin_dir) + mock_script_path = system.form_path(mock_bin_dir, "show-macros-proper") + + full_script = ["#!/bin/sh", script_content] + if exit_code != 0: + full_script.append(f"exit {exit_code}") + + system.write_file(mock_script_path, "\n".join(full_script)) + os.chmod(mock_script_path, 0o755) + + return f"PATH={system.absolute_path(mock_bin_dir)}:{os.environ.get('PATH', '')}" + + def helper_get_analyzer(self, is_heuristic=False): + """Helper to instantiate the FailureAnalyzer with the temp directory (DRY).""" + return THE_MODULE.FailureAnalyzer( + results_dir=self.temp_base, + is_heuristic=is_heuristic + ) + + def helper_run_analyzer_cli(self, cli_options: str = "", env_vars: str | None = None): + """Helper to run the failure_analyzer script via the CLI (DRY).""" + abs_results_dir = system.absolute_path(self.temp_base) + # Prepend the mandatory results-dir option to all calls. + full_options = f'--results-dir {abs_results_dir} {cli_options}' + return self.run_script(options=full_options.strip(), env_options=env_vars) + + # -------------------------------------------------------------------------- + # Part 1: API Tests (For logic with no external dependencies) + # -------------------------------------------------------------------------- + + @pytest.mark.xfail + def test_api_default_mode_aggregation(self): + """API TEST: Verifies analysis and aggregation logic for default mode.""" + debug.trace(4, "TestFailureAnalyzer.test_api_default_mode_aggregation()") + system.write_file(system.form_path(self.temp_base, "test1.outputpp.out"), "not ok 1 - f1") + system.write_file(system.form_path(self.temp_base, "test1.outputpp"), "function f1_actual() {\n cmd_a\n}") + system.write_file(system.form_path(self.temp_base, "test2.outputpp.out"), "not ok 1 - f2") + system.write_file(system.form_path(self.temp_base, "test2.outputpp"), "function f2_actual() {\n cmd_b\n}") + system.write_file(system.form_path(self.temp_base, "test3.outputpp.out"), "not ok 1 - f3") + system.write_file(system.form_path(self.temp_base, "test3.outputpp"), "function f3_actual() {\n cmd_a\n}") + + analyzer = self.helper_get_analyzer(is_heuristic=False) + analyzer.run() + report_data = analyzer.report_data + + self.do_assert(len(report_data) == 2) + command, cmd_a_data = report_data[0] + self.do_assert(command.strip() == 'cmd_a') + self.do_assert(cmd_a_data['count'] == 2) + self.do_assert(cmd_a_data['impact'] == 4) + + @pytest.mark.xfail + def test_api_no_files_found(self): + """API TEST: Ensures an empty list is returned for an empty directory.""" + debug.trace(4, "TestFailureAnalyzer.test_api_no_files_found()") + analyzer = self.helper_get_analyzer(is_heuristic=False) + analyzer.run() + self.do_assert(analyzer.report_data == []) + + @pytest.mark.xfail + def test_api_no_failures_found(self): + """API TEST: Ensures an empty report is generated if all tests pass.""" + debug.trace(4, "TestFailureAnalyzer.test_api_no_failures_found()") + system.write_file(system.form_path(self.temp_base, "test1.outputpp.out"), "ok 1 - f1") + system.write_file(system.form_path(self.temp_base, "test1.outputpp"), "function f1_actual() {\n cmd_a\n}") + analyzer = self.helper_get_analyzer(is_heuristic=False) + analyzer.run() + self.do_assert(analyzer.report_data == []) + + @pytest.mark.xfail + def test_api_recursive_directory_search(self): + """API TEST: Verifies that the tool finds files in subdirectories.""" + debug.trace(4, "TestFailureAnalyzer.test_api_recursive_directory_search()") + sub_dir = system.form_path(self.temp_base, "subdir") + system.create_directory(sub_dir) + system.write_file(system.form_path(self.temp_base, "test1.outputpp.out"), "not ok 1 - f1") + system.write_file(system.form_path(self.temp_base, "test1.outputpp"), "function f1_actual() {\n cmd_a\n}") + system.write_file(system.form_path(sub_dir, "test2.outputpp.out"), "not ok 1 - f2") + system.write_file(system.form_path(sub_dir, "test2.outputpp"), "function f2_actual() {\n cmd_b\n}") + + analyzer = self.helper_get_analyzer(is_heuristic=False) + analyzer.run() + self.do_assert(len(analyzer.report_data) == 2) + + @pytest.mark.xfail + def test_api_special_characters_in_names(self): + """API TEST: Verifies correct parsing of names with spaces (default mode).""" + debug.trace(4, "TestFailureAnalyzer.test_api_special_characters_in_names()") + system.write_file(system.form_path(self.temp_base, "spaces.outputpp.out"), "not ok 1 - my test with spaces") + system.write_file(system.form_path(self.temp_base, "spaces.outputpp"), "function my_test_with_spaces_actual() {\n cmd_with_space\n}") + analyzer = self.helper_get_analyzer(is_heuristic=False) + analyzer.run() + report_data = analyzer.report_data + self.do_assert(len(report_data) == 1 and report_data[0][0].strip() == "cmd_with_space") + + # -------------------------------------------------------------------------- + # Part 2: CLI Tests (For logic involving external commands) + # -------------------------------------------------------------------------- + + @pytest.mark.xfail + def test_cli_heuristic_mode_calculation(self): + """CLI TEST: Verifies heuristic calculations via PATH trick.""" + debug.trace(4, "TestFailureAnalyzer.test_cli_heuristic_mode_calculation()") + env_vars = self.helper_setup_mock_bin_and_env("echo 'macro-one\nmacro-two'") + log_content = "ok 1\n+ macro-one\n\n==========\nnot ok 2\n+ macro-one\n\n==========\nnot ok 3\n+ macro-two" + system.write_file(system.form_path(self.temp_base, "test1.outputpp.out"), log_content) + + self.helper_run_analyzer_cli(cli_options='--heuristic', env_vars=env_vars) + + report_path = system.form_path(self.temp_base, "failure_analyzer_heuristic.json") + report_data = json.loads(system.read_file(report_path)) + self.do_assert(len(report_data) == 2) + report_data.sort(key=lambda x: x['macro']) + self.do_assert(report_data[0]['macro'] == 'macro-one' and report_data[0]['pct_bad'] == 50.0) + + @pytest.mark.xfail + def test_cli_heuristic_complex_correlation(self): + """CLI TEST: Stress-tests the heuristic ranking via PATH trick.""" + debug.trace(4, "TestFailureAnalyzer.test_cli_heuristic_complex_correlation()") + env_vars = self.helper_setup_mock_bin_and_env("echo 'macro-A\nmacro-B\nhelper-macro'") + log_content = "not ok 1\n+ macro-A\n+ helper-macro\n" + "==========\n" + "not ok 2\n+ macro-A\n+ helper-macro\n" + "==========\n" + "not ok 3\n+ macro-A\n+ macro-B\n+ helper-macro\n" + "==========\n" + "ok 4\n+ macro-A\n+ helper-macro\n" + "==========\n" + "ok 5\n+ macro-B\n+ helper-macro\n" + "==========\n" + "ok 6\n+ macro-B\n+ helper-macro\n" + system.write_file(system.form_path(self.temp_base, "complex.outputpp.out"), log_content) + + self.helper_run_analyzer_cli(cli_options='--heuristic', env_vars=env_vars) + + report_path = system.form_path(self.temp_base, "failure_analyzer_heuristic.json") + report_data = json.loads(system.read_file(report_path)) + self.do_assert(len(report_data) == 3) + self.do_assert(report_data[0]['macro'] == 'macro-A') + self.do_assert(report_data[1]['macro'] == 'helper-macro') + self.do_assert(report_data[2]['macro'] == 'macro-B') + + @pytest.mark.xfail + def test_cli_heuristic_show_macros_fails(self): + """CLI TEST: Ensures graceful exit if 'show-macros-proper' fails.""" + debug.trace(4, "TestFailureAnalyzer.test_cli_heuristic_show_macros_fails()") + env_vars = self.helper_setup_mock_bin_and_env("echo 'uh oh' >&2", exit_code=1) + self.helper_run_analyzer_cli(cli_options='--heuristic', env_vars=env_vars) + stderr = self.get_stderr() + self.do_assert("Error: Could not execute 'show-macros-proper'", stderr) + + @pytest.mark.xfail + def test_cli_heuristic_no_macros_found(self): + """CLI TEST: Ensures graceful exit if 'show-macros-proper' returns nothing.""" + debug.trace(4, "TestFailureAnalyzer.test_cli_heuristic_no_macros_found()") + env_vars = self.helper_setup_mock_bin_and_env("") # Empty script + system.write_file(system.form_path(self.temp_base, "test.outputpp.out"), "not ok 1") + self.helper_run_analyzer_cli(cli_options='--heuristic', env_vars=env_vars) + stderr = self.get_stderr() + self.do_assert("Error: 'show-macros-proper' returned no valid macros", stderr) + + @pytest.mark.xfail + def test_cli_heuristic_flag(self): + """CLI TEST: Ensures the --heuristic flag activates the correct mode.""" + debug.trace(4, "TestFailureAnalyzer.test_cli_heuristic_flag()") + env_vars = self.helper_setup_mock_bin_and_env("echo 'macro-one'") + system.write_file(system.form_path(self.temp_base, "test.outputpp.out"), "not ok 1") + output = self.helper_run_analyzer_cli(cli_options='--heuristic', env_vars=env_vars) + self.do_assert("Running Macro Failure Heuristic Analysis", output) + + @pytest.mark.xfail + def test_cli_json_filename_override(self): + """CLI TEST: Ensures --json-filename overrides the default.""" + debug.trace(4, "TestFailureAnalyzer.test_cli_json_filename_override()") + system.write_file(system.form_path(self.temp_base, "test.outputpp.out"), "not ok 1 - f1") + system.write_file(system.form_path(self.temp_base, "test.outputpp"), "function f1_actual() {\n cmd_a\n}") + custom_report_path = system.form_path(self.temp_base, "my-custom-report.json") + output = self.helper_run_analyzer_cli(cli_options=f'--json-filename {custom_report_path}') + self.do_assert(f"Writing full report to {custom_report_path}", output) + self.do_assert(system.file_exists(custom_report_path)) + + @pytest.mark.xfail + def test_cli_missing_directory(self): + """CLI TEST: Ensures the script exits gracefully if the directory is missing.""" + debug.trace(4, "TestFailureAnalyzer.test_cli_missing_directory()") + non_existent_dir = os.path.join(system.absolute_path(self.temp_base), "non_existent_dir") + # Override the helper for this specific case since we need a non-existent directory. + self.run_script(options=f'--results-dir {non_existent_dir}') + stderr = self.get_stderr() + self.do_assert(f"Error: Directory '{non_existent_dir}' does not exist", stderr) + + @pytest.mark.xfail + def test_cli_default_json_filename_creation(self): + """CLI TEST: Verifies correct default JSON report file creation.""" + debug.trace(4, "TestFailureAnalyzer.test_cli_default_json_filename_creation()") + system.write_file(system.form_path(self.temp_base, "test.outputpp.out"), "not ok 1 - f1") + system.write_file(system.form_path(self.temp_base, "test.outputpp"), "function f1_actual() {\n cmd_a\n}") + self.helper_run_analyzer_cli() # No extra options needed + default_report = system.form_path(self.temp_base, "failure_analyzer_report.json") + self.do_assert(system.file_exists(default_report)) + +# ------------------------------------------------------------------------ + +# Standard entry point for the test runner +if __name__ == '__main__': + debug.trace_current_context() + invoke_tests(__file__) \ No newline at end of file diff --git a/tests/tomasohara-aliases-test.ipynb b/tests/tomasohara-aliases-test.ipynb index 334a992b..c4e29fe3 100644 --- a/tests/tomasohara-aliases-test.ipynb +++ b/tests/tomasohara-aliases-test.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -12,7 +12,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -22,7 +22,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -32,12 +32,12 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", - "\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "## linebr Uses simple bash command to create a series of hypens (-)\n", "## OLD\n", "# alias linebr=\"printf '%*s\\n' \"${COLUMNS:-$(tput cols)}\" '' | tr ' ' -\"\n", @@ -48,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -65,7 +65,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "metadata": {}, "outputs": [ { @@ -83,7 +83,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -106,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [ { diff --git a/tests/trace-extensionless-shortcut-V2.ipynb b/tests/trace-extensionless-shortcut-V2.ipynb index 6b9bb4cd..66ca709d 100644 --- a/tests/trace-extensionless-shortcut-V2.ipynb +++ b/tests/trace-extensionless-shortcut-V2.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "ee0d8a16", "metadata": {}, "outputs": [], @@ -12,12 +12,15 @@ "## Example: \n", "## $ echo 'Hii'\n", "## | Hi?2004l\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "65d43538", "metadata": {}, "outputs": [ @@ -37,7 +40,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "d623c9a9", "metadata": {}, "outputs": [], @@ -60,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "f93dc93d", "metadata": {}, "outputs": [], @@ -71,7 +74,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ab954c7f", "metadata": {}, "outputs": [], @@ -95,7 +98,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "8d2d64e7", "metadata": {}, "outputs": [], @@ -111,7 +114,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "5527171c", "metadata": {}, "outputs": [ @@ -131,7 +134,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "bfb7e7ba", "metadata": {}, "outputs": [ @@ -151,7 +154,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "faf99139", "metadata": {}, "outputs": [], @@ -162,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "b2919e2f", "metadata": {}, "outputs": [ @@ -184,7 +187,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "40460077", "metadata": {}, "outputs": [ @@ -204,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "94ed70f0", "metadata": {}, "outputs": [], @@ -216,7 +219,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "98b974b4", "metadata": {}, "outputs": [ @@ -249,7 +252,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "142d960b", "metadata": {}, "outputs": [], @@ -261,7 +264,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "0ef5e724", "metadata": {}, "outputs": [ @@ -281,7 +284,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "1584698d", "metadata": {}, "outputs": [ @@ -305,7 +308,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "c7070a99", "metadata": {}, "outputs": [], @@ -320,7 +323,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "22a23226", "metadata": {}, "outputs": [ @@ -351,7 +354,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "a99c8f04", "metadata": {}, "outputs": [], @@ -365,7 +368,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "d6117d46", "metadata": {}, "outputs": [ @@ -384,7 +387,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "95161560", "metadata": {}, "outputs": [], @@ -397,7 +400,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "8298cf91", "metadata": {}, "outputs": [ @@ -418,7 +421,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "3ca47040", "metadata": {}, "outputs": [], @@ -431,7 +434,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "5877539b", "metadata": {}, "outputs": [ @@ -450,7 +453,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "b4a3202e", "metadata": {}, "outputs": [ @@ -469,7 +472,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "104d555f", "metadata": {}, "outputs": [ @@ -498,7 +501,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "66ff2781", "metadata": {}, "outputs": [ @@ -517,7 +520,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "33d36d20", "metadata": {}, "outputs": [ @@ -536,7 +539,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "83dfb50a", "metadata": {}, "outputs": [ @@ -556,7 +559,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "312df7a5", "metadata": {}, "outputs": [], @@ -568,7 +571,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "8e6b254c", "metadata": {}, "outputs": [ @@ -588,7 +591,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "3a5731b8", "metadata": {}, "outputs": [], @@ -599,7 +602,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "672d1bd6", "metadata": {}, "outputs": [], @@ -612,7 +615,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "2b2b495d", "metadata": {}, "outputs": [], @@ -625,7 +628,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "527d72eb", "metadata": {}, "outputs": [], @@ -637,7 +640,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "937d9242", "metadata": {}, "outputs": [ @@ -657,7 +660,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "59ae3af6", "metadata": {}, "outputs": [ @@ -676,7 +679,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "id": "d9ba3659", "metadata": {}, "outputs": [ @@ -695,7 +698,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "92e8abbd", "metadata": {}, "outputs": [], @@ -707,7 +710,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "id": "c7e4c426", "metadata": { "scrolled": false @@ -729,7 +732,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "id": "1d96c16e", "metadata": { "scrolled": true @@ -752,7 +755,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "id": "71adad1d", "metadata": {}, "outputs": [ @@ -773,7 +776,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": null, "id": "d57951d5", "metadata": {}, "outputs": [], @@ -784,7 +787,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": null, "id": "9c99b8aa", "metadata": {}, "outputs": [], @@ -794,7 +797,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": null, "id": "86419b9f", "metadata": {}, "outputs": [ @@ -815,7 +818,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": null, "id": "d9ed2744", "metadata": {}, "outputs": [], @@ -827,7 +830,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": null, "id": "f45efa52", "metadata": {}, "outputs": [ @@ -847,7 +850,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": null, "id": "addf3591", "metadata": {}, "outputs": [ @@ -867,7 +870,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": null, "id": "49d6d56d", "metadata": { "scrolled": true diff --git a/tests/trace-extensionless-shortcut-unicode.ipynb b/tests/trace-extensionless-shortcut-unicode.ipynb index b5ee5d0f..1d1bf157 100644 --- a/tests/trace-extensionless-shortcut-unicode.ipynb +++ b/tests/trace-extensionless-shortcut-unicode.ipynb @@ -2,7 +2,22 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, + "id": "112f58ea", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [], + "source": [ + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" + ] + }, + { + "cell_type": "code", + "execution_count": null, "id": "65d43538", "metadata": {}, "outputs": [ @@ -22,7 +37,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "d623c9a9", "metadata": {}, "outputs": [], @@ -43,7 +58,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "0ff8f157", "metadata": {}, "outputs": [], @@ -54,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "ab954c7f", "metadata": {}, "outputs": [], @@ -85,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "bfd630e0", "metadata": {}, "outputs": [], @@ -98,7 +113,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "ec6df159", "metadata": {}, "outputs": [ @@ -118,7 +133,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "bbd76505", "metadata": {}, "outputs": [ @@ -138,7 +153,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "2b491d21", "metadata": {}, "outputs": [ @@ -162,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "a5135f1c", "metadata": {}, "outputs": [], @@ -173,7 +188,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "42696142", "metadata": {}, "outputs": [], @@ -187,7 +202,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "bec27579", "metadata": { "scrolled": false @@ -211,7 +226,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "2de08407", "metadata": {}, "outputs": [ @@ -235,7 +250,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "3544f813", "metadata": {}, "outputs": [], @@ -246,7 +261,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "45f82241", "metadata": {}, "outputs": [], @@ -257,7 +272,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "93acec92", "metadata": {}, "outputs": [], @@ -268,7 +283,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "50fe14f7", "metadata": {}, "outputs": [], @@ -283,7 +298,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "a54fa112", "metadata": {}, "outputs": [ diff --git a/tests/trace-file-manipulation.ipynb b/tests/trace-file-manipulation.ipynb index aeac2be1..4b1afd24 100644 --- a/tests/trace-file-manipulation.ipynb +++ b/tests/trace-file-manipulation.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "6dcea75d", "metadata": { "scrolled": true @@ -19,7 +19,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "65d43538", "metadata": {}, "outputs": [ @@ -44,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "d623c9a9", "metadata": {}, "outputs": [], @@ -60,12 +60,13 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "16cdccbd", "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "alias testuser=\"sed -r \"s/\"$USER\"+/user/g\"\"\n", "## alias testnum=\"sed -r \"s/[0-9]/X/g\"\"\n", "\n", @@ -75,7 +76,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "0ff8f157", "metadata": {}, "outputs": [], @@ -94,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "ab954c7f", "metadata": {}, "outputs": [], @@ -132,7 +133,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "ec6df159", "metadata": {}, "outputs": [ @@ -152,7 +153,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "a1426f49", "metadata": {}, "outputs": [ @@ -172,7 +173,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "ff56cd62", "metadata": {}, "outputs": [], @@ -183,7 +184,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "0d1949fc", "metadata": {}, "outputs": [], @@ -206,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "1d95de59", "metadata": {}, "outputs": [], @@ -217,7 +218,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "260b6c04", "metadata": {}, "outputs": [], @@ -232,7 +233,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "9d9abc8e", "metadata": {}, "outputs": [ @@ -255,7 +256,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "5fcbc4e2", "metadata": {}, "outputs": [], @@ -266,7 +267,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "43514fc3", "metadata": {}, "outputs": [], @@ -278,7 +279,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "5e6bb71e", "metadata": {}, "outputs": [ @@ -301,7 +302,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "1b62ea73", "metadata": {}, "outputs": [], @@ -332,7 +333,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "e1a5901e", "metadata": {}, "outputs": [ @@ -352,7 +353,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "5fa6f0ad", "metadata": {}, "outputs": [ @@ -373,7 +374,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "37e401f5", "metadata": { "scrolled": true @@ -398,7 +399,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "a356c468", "metadata": {}, "outputs": [ @@ -421,7 +422,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "744c8bef", "metadata": {}, "outputs": [], @@ -431,7 +432,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "d88eaa6b", "metadata": { "scrolled": true @@ -460,7 +461,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "73861304", "metadata": {}, "outputs": [ @@ -480,7 +481,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "1d1a7f24", "metadata": {}, "outputs": [ @@ -502,7 +503,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "7fa686e6", "metadata": {}, "outputs": [ @@ -522,7 +523,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "7f1183a5", "metadata": {}, "outputs": [], @@ -536,7 +537,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "5077b85c", "metadata": { "scrolled": true @@ -553,7 +554,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "c0eea4ec", "metadata": {}, "outputs": [ @@ -573,7 +574,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "49d75322", "metadata": { "scrolled": true @@ -603,7 +604,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "fee766fe", "metadata": {}, "outputs": [ @@ -625,7 +626,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "2e160f0e", "metadata": { "scrolled": true @@ -655,7 +656,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "49adcfa3", "metadata": {}, "outputs": [ @@ -678,7 +679,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "475b5f63", "metadata": {}, "outputs": [ diff --git a/tests/trace-line-words-commands.ipynb b/tests/trace-line-words-commands.ipynb index 0edcac5a..0b05eb73 100644 --- a/tests/trace-line-words-commands.ipynb +++ b/tests/trace-line-words-commands.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "6dcea75d", "metadata": {}, "outputs": [], @@ -12,12 +12,15 @@ "## Example: \n", "## $ echo 'Hii'\n", "## | Hi?2004l\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "65d43538", "metadata": {}, "outputs": [ @@ -40,7 +43,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "d623c9a9", "metadata": {}, "outputs": [], @@ -56,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "0ff8f157", "metadata": {}, "outputs": [], @@ -70,7 +73,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ab954c7f", "metadata": {}, "outputs": [ @@ -114,7 +117,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "b34ce805", "metadata": {}, "outputs": [], @@ -128,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "ec6df159", "metadata": {}, "outputs": [ @@ -147,7 +150,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "aa40fd1c", "metadata": {}, "outputs": [ @@ -166,7 +169,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "1a81a0db", "metadata": {}, "outputs": [], @@ -177,7 +180,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "bbcd9a49", "metadata": {}, "outputs": [], @@ -198,7 +201,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "1f9ba9a1", "metadata": {}, "outputs": [ @@ -216,7 +219,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "9f34ee1c", "metadata": {}, "outputs": [ @@ -240,7 +243,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "6c6506f8", "metadata": {}, "outputs": [ @@ -264,7 +267,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "06a0841f", "metadata": {}, "outputs": [ @@ -288,7 +291,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "c50a7083", "metadata": {}, "outputs": [ @@ -312,7 +315,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "9c1a26c6", "metadata": { "scrolled": false @@ -338,7 +341,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "07e67b85", "metadata": {}, "outputs": [], @@ -351,7 +354,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "93c128a3", "metadata": {}, "outputs": [], @@ -363,7 +366,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "85a87403", "metadata": {}, "outputs": [ diff --git a/tests/trace-linux-admin-alias-NOBATSPP.ipynb b/tests/trace-linux-admin-alias-NOBATSPP.ipynb index 8557ff63..f4e08820 100644 --- a/tests/trace-linux-admin-alias-NOBATSPP.ipynb +++ b/tests/trace-linux-admin-alias-NOBATSPP.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "6dcea75d", "metadata": {}, "outputs": [], @@ -15,12 +15,16 @@ "# $ echo 'Hi'\n", "# | Hi?2004l\n", "\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", + "alias testuser=\"sed -r \"s/\"$USER\"+/userxf333/g\"\"\n", + "alias testnum=\"sed -r \"s/[0-9]/N/g\"\" " ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "65d43538", "metadata": {}, "outputs": [ @@ -43,7 +47,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "d623c9a9", "metadata": {}, "outputs": [], @@ -60,18 +64,15 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "5c9df606", "metadata": {}, "outputs": [], - "source": [ - "alias testuser=\"sed -r \"s/\"$USER\"+/userxf333/g\"\"\n", - "alias testnum=\"sed -r \"s/[0-9]/N/g\"\" " - ] + "source": [] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "0ff8f157", "metadata": {}, "outputs": [ @@ -95,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "ab954c7f", "metadata": {}, "outputs": [ @@ -127,7 +128,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "ec6df159", "metadata": {}, "outputs": [ @@ -149,7 +150,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "40b5dc82", "metadata": {}, "outputs": [], @@ -161,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "fc4c90a1", "metadata": {}, "outputs": [], @@ -176,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "2dd529ee", "metadata": {}, "outputs": [ @@ -200,7 +201,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "b86e6afa", "metadata": {}, "outputs": [ @@ -221,7 +222,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "264d60c8", "metadata": {}, "outputs": [ @@ -243,7 +244,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "9945a9ac", "metadata": {}, "outputs": [], @@ -260,7 +261,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "dd05882e", "metadata": {}, "outputs": [], @@ -277,7 +278,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "303396ad", "metadata": {}, "outputs": [], @@ -293,7 +294,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "774ddb93", "metadata": {}, "outputs": [], @@ -317,7 +318,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "593024ca", "metadata": {}, "outputs": [ @@ -336,7 +337,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "5336cde2", "metadata": {}, "outputs": [], @@ -351,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "4d2d5ce1", "metadata": {}, "outputs": [ @@ -373,7 +374,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "3fcc7642", "metadata": {}, "outputs": [ @@ -398,7 +399,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "d8bcb35b", "metadata": {}, "outputs": [ @@ -416,7 +417,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "57d6d4d4", "metadata": { "scrolled": false @@ -449,7 +450,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "251b30e5", "metadata": {}, "outputs": [], @@ -471,7 +472,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "21b4c8ab", "metadata": {}, "outputs": [], @@ -481,7 +482,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "d7d44c1d", "metadata": {}, "outputs": [], @@ -492,7 +493,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "ea891649", "metadata": {}, "outputs": [ diff --git a/tests/trace-python-commands.ipynb b/tests/trace-python-commands.ipynb index 935293bb..d6c30921 100644 --- a/tests/trace-python-commands.ipynb +++ b/tests/trace-python-commands.ipynb @@ -2,7 +2,22 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, + "id": "94946e7c", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [], + "source": [ + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" + ] + }, + { + "cell_type": "code", + "execution_count": null, "id": "6cc6dd0b-d935-4918-a02a-dff0b8c92b77", "metadata": {}, "outputs": [], @@ -16,7 +31,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "914d42a9-da83-4954-b105-2d82994dd064", "metadata": {}, "outputs": [], @@ -30,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "177c9e8b-7d60-48a9-b5ae-f58c8732e1cb", "metadata": {}, "outputs": [ @@ -51,7 +66,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "6e085f64-e505-458b-af13-9d46d12913cc", "metadata": {}, "outputs": [ @@ -74,7 +89,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "76e3d870-b4e7-457e-af7b-bcd0beb5f74c", "metadata": {}, "outputs": [], @@ -100,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "79248c1c-7d65-46c3-abbd-7fecb18e4073", "metadata": {}, "outputs": [], @@ -111,7 +126,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "65d43538", "metadata": {}, "outputs": [], @@ -126,7 +141,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "1da73b27", "metadata": {}, "outputs": [], @@ -143,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "0ff8f157", "metadata": {}, "outputs": [ @@ -169,7 +184,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "7b9a14cc", "metadata": {}, "outputs": [ @@ -227,7 +242,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "bb14e4df", "metadata": {}, "outputs": [], @@ -247,7 +262,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "0359b346", "metadata": {}, "outputs": [], @@ -264,7 +279,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "e7d436e5", "metadata": {}, "outputs": [ @@ -287,7 +302,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "3c7a4a1d-83ec-4bb0-9556-7abc80e3a5e5", "metadata": {}, "outputs": [], @@ -299,7 +314,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "f7249c59-054a-4382-af5c-6119b323bff7", "metadata": {}, "outputs": [ @@ -320,7 +335,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "17e83d2a-cf5c-48bd-b4d2-302b4b0a140c", "metadata": {}, "outputs": [ @@ -340,7 +355,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "bbb90e81-74ac-4634-a9d2-0b632d824bf4", "metadata": {}, "outputs": [ @@ -365,7 +380,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "5039b234", "metadata": { "scrolled": true @@ -394,7 +409,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "cab9db0c", "metadata": {}, "outputs": [ @@ -417,7 +432,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "207d98f0", "metadata": {}, "outputs": [], @@ -429,7 +444,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "6e4b2871", "metadata": {}, "outputs": [], @@ -445,7 +460,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "4a313b5a-c666-4890-9655-c6f9850bf653", "metadata": {}, "outputs": [ @@ -471,7 +486,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "dd9e32d2-2f31-4049-b0a1-4b65dd2df006", "metadata": {}, "outputs": [ @@ -493,7 +508,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "c83d89b2-c550-4430-a770-50facaba14c3", "metadata": {}, "outputs": [ @@ -513,7 +528,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "852d5ab4", "metadata": {}, "outputs": [], @@ -526,7 +541,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "e82509c6", "metadata": {}, "outputs": [ @@ -552,7 +567,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "e2cc5d95", "metadata": {}, "outputs": [ @@ -570,7 +585,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "d1da1f97", "metadata": {}, "outputs": [ @@ -588,7 +603,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "caf8bfd0", "metadata": {}, "outputs": [], @@ -646,7 +661,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "1912bb79-d984-4788-84d6-3759caf3383d", "metadata": {}, "outputs": [], @@ -657,7 +672,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "30fc8ae2-fb50-4f19-908e-1178ef19776e", "metadata": { "scrolled": true @@ -680,7 +695,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "d98b6d58", "metadata": {}, "outputs": [ @@ -707,7 +722,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "93146b8d", "metadata": {}, "outputs": [ @@ -733,7 +748,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "9dcb601f", "metadata": {}, "outputs": [ @@ -761,7 +776,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "8080d06d", "metadata": {}, "outputs": [ @@ -787,7 +802,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "b8c1c892", "metadata": { "scrolled": true @@ -815,7 +830,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "488f8718-37d7-46e7-9b09-bb5ba822b55b", "metadata": {}, "outputs": [ @@ -838,7 +853,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "id": "0cc12ce8-2a70-4cc6-b31d-32f6a4b222fd", "metadata": {}, "outputs": [ @@ -864,7 +879,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "c0b6f931", "metadata": {}, "outputs": [ @@ -891,7 +906,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "id": "2e0b2a50-1897-4828-aafc-e743b1b95a4f", "metadata": {}, "outputs": [], @@ -904,7 +919,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "id": "218b4eda-a344-432e-a2cc-4bbe6003c61f", "metadata": {}, "outputs": [], @@ -915,7 +930,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "id": "cdd86ce9-6fb4-4c6f-98f8-e34d75f77942", "metadata": {}, "outputs": [ @@ -959,7 +974,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": null, "id": "9a40ffff", "metadata": {}, "outputs": [], @@ -975,7 +990,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": null, "id": "b6e7b1d1", "metadata": {}, "outputs": [], @@ -988,7 +1003,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": null, "id": "5dbc85eb", "metadata": {}, "outputs": [], @@ -1019,7 +1034,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": null, "id": "9322aa5a", "metadata": {}, "outputs": [], @@ -1046,7 +1061,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": null, "id": "caa3332b", "metadata": {}, "outputs": [], @@ -1068,7 +1083,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": null, "id": "9c155aa3", "metadata": {}, "outputs": [], @@ -1086,7 +1101,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": null, "id": "53136103", "metadata": {}, "outputs": [], @@ -1101,7 +1116,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": null, "id": "31d1b151", "metadata": {}, "outputs": [], @@ -1113,7 +1128,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": null, "id": "3b6aab89", "metadata": {}, "outputs": [], @@ -1129,7 +1144,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": null, "id": "88b697b0-82c6-48c2-8b0d-96d922b177b6", "metadata": {}, "outputs": [], @@ -1142,7 +1157,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": null, "id": "c3845ce6-bf26-423c-81f3-356acca66f8d", "metadata": {}, "outputs": [ @@ -1177,7 +1192,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": null, "id": "833520df-e503-4131-bbdd-98bd990a9d2f", "metadata": {}, "outputs": [ @@ -1205,7 +1220,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": null, "id": "4f226d82-2376-4caf-9b40-49a742a06980", "metadata": {}, "outputs": [ @@ -1225,7 +1240,7 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": null, "id": "4a08ccc0-4d02-49a9-9744-ff4d2707f812", "metadata": {}, "outputs": [ @@ -1247,7 +1262,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": null, "id": "59e5fe12-c47b-4600-9487-e1a746aece67", "metadata": {}, "outputs": [ @@ -1271,7 +1286,7 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": null, "id": "2c5ba0e4-e09e-4703-856c-5b5c436f6d7c", "metadata": {}, "outputs": [], @@ -1281,7 +1296,7 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": null, "id": "df7835ca-a1c2-4ad9-9acb-4bb8a63afcbc", "metadata": {}, "outputs": [ @@ -1305,7 +1320,7 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": null, "id": "4c49d849-0dfe-484e-ba6c-8ee27ca755ff", "metadata": {}, "outputs": [ @@ -1327,7 +1342,7 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": null, "id": "d1ea335b-91bd-4016-8456-6dbfb6f0aaf3", "metadata": {}, "outputs": [ @@ -1354,7 +1369,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": null, "id": "b49f6117-3b7a-47e5-a51f-5456514a1353", "metadata": {}, "outputs": [], @@ -1365,7 +1380,7 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": null, "id": "c57545c5", "metadata": {}, "outputs": [], @@ -1380,7 +1395,7 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": null, "id": "008e51b7", "metadata": {}, "outputs": [ @@ -1398,7 +1413,7 @@ }, { "cell_type": "code", - "execution_count": 65, + "execution_count": null, "id": "a3d18560", "metadata": {}, "outputs": [ diff --git a/tests/trace-setup-sorting-wrappers.ipynb b/tests/trace-setup-sorting-wrappers.ipynb index d7c229da..c4765a51 100644 --- a/tests/trace-setup-sorting-wrappers.ipynb +++ b/tests/trace-setup-sorting-wrappers.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "65d43538", "metadata": {}, "outputs": [ @@ -27,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "d623c9a9", "metadata": {}, "outputs": [], @@ -43,7 +43,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "0ff8f157", "metadata": {}, "outputs": [], @@ -60,13 +60,13 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "54d25281", "metadata": {}, "outputs": [], "source": [ "# Global Setup\n", - "\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", "# alias testnum=\"sed -r \"s/[0-9]/H/g\"\" \n", "alias testuser=\"sed -r \"s/\"$USER\"+/userxf333/g\"\"\n", "alias testnum=\"sed -r \"s/[0-9][0-9]*/N/g\"\"\n", @@ -75,7 +75,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ab954c7f", "metadata": {}, "outputs": [], @@ -106,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "ec6df159", "metadata": { "scrolled": true @@ -132,7 +132,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "23c3b474", "metadata": {}, "outputs": [ @@ -154,7 +154,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "badd6828", "metadata": {}, "outputs": [], @@ -165,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "78c13815", "metadata": {}, "outputs": [], @@ -176,7 +176,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "c91d1116", "metadata": { "scrolled": true @@ -207,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "a405288e", "metadata": {}, "outputs": [], @@ -217,7 +217,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "f440c180", "metadata": {}, "outputs": [ @@ -236,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "19316ba3", "metadata": {}, "outputs": [ @@ -256,7 +256,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "776f4c45", "metadata": {}, "outputs": [ @@ -276,7 +276,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "312d103e", "metadata": {}, "outputs": [ @@ -297,7 +297,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "28e58950", "metadata": {}, "outputs": [ @@ -317,7 +317,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "f113e7d6-eebf-4080-8472-0aee9a72fd13", "metadata": {}, "outputs": [ @@ -338,7 +338,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "333b2760-2134-48e8-8621-4d05bb019661", "metadata": {}, "outputs": [], @@ -348,7 +348,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "b15d7d7c-79c1-44e5-8b84-751ae0d1a107", "metadata": {}, "outputs": [ @@ -366,7 +366,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "a8f3c7d0-bd44-430a-89e1-0847ee844c69", "metadata": {}, "outputs": [ @@ -384,7 +384,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "5d4b26be-2c2a-484c-b2a1-8e558f894683", "metadata": {}, "outputs": [ @@ -402,7 +402,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "cd321795-8cd4-4342-8e58-095193b28d16", "metadata": {}, "outputs": [ @@ -424,7 +424,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "bcaf053a", "metadata": {}, "outputs": [ @@ -451,7 +451,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "4270d960", "metadata": {}, "outputs": [ @@ -472,7 +472,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "6e12887f", "metadata": {}, "outputs": [ diff --git a/tests/trace-unix-alias.ipynb b/tests/trace-unix-alias.ipynb index 5628df6a..7550d4b7 100644 --- a/tests/trace-unix-alias.ipynb +++ b/tests/trace-unix-alias.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "782d47d4", "metadata": {}, "outputs": [], @@ -12,12 +12,14 @@ "## Example: \n", "## $ echo 'Hii'\n", "## | Hi?2004l\n", - "# bind 'set enable-bracketed-paste off'" + "# bind 'set enable-bracketed-paste off'\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "65d43538", "metadata": {}, "outputs": [ @@ -44,7 +46,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "d623c9a9", "metadata": {}, "outputs": [ @@ -68,7 +70,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "ab954c7f", "metadata": {}, "outputs": [], @@ -87,7 +89,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ec6df159", "metadata": {}, "outputs": [], @@ -101,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "ff290d73", "metadata": {}, "outputs": [ @@ -129,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "f71fdf21", "metadata": {}, "outputs": [ @@ -152,7 +154,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "760a7389", "metadata": {}, "outputs": [], @@ -163,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "b4af87a1", "metadata": {}, "outputs": [], @@ -175,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "3591194c", "metadata": { "scrolled": true @@ -193,7 +195,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "0198effb", "metadata": {}, "outputs": [], @@ -205,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "cb7f48dc", "metadata": {}, "outputs": [ @@ -224,7 +226,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "cd0c80db", "metadata": {}, "outputs": [ @@ -251,7 +253,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "c0c74f75", "metadata": {}, "outputs": [], @@ -266,7 +268,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "d6f37399", "metadata": {}, "outputs": [], @@ -282,7 +284,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "b535f2eb", "metadata": {}, "outputs": [], @@ -293,7 +295,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "761a2cd8", "metadata": {}, "outputs": [ @@ -321,7 +323,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "8f904a21", "metadata": {}, "outputs": [ @@ -340,7 +342,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "e38e8554", "metadata": {}, "outputs": [ @@ -359,7 +361,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "d792021b", "metadata": {}, "outputs": [], @@ -374,7 +376,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "5cdac362", "metadata": {}, "outputs": [], @@ -385,7 +387,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "49da8c7e", "metadata": {}, "outputs": [ @@ -416,7 +418,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "9bea16c5", "metadata": {}, "outputs": [ @@ -436,7 +438,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "e0e10406", "metadata": {}, "outputs": [ @@ -455,7 +457,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "28e700ce", "metadata": {}, "outputs": [ @@ -473,7 +475,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "e3e42a18", "metadata": { "scrolled": true @@ -497,7 +499,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "43c24ea0", "metadata": {}, "outputs": [ @@ -516,7 +518,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "73ea76b9", "metadata": {}, "outputs": [ @@ -538,7 +540,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "0ee7e74e", "metadata": {}, "outputs": [ @@ -561,7 +563,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "212ef1c9", "metadata": {}, "outputs": [ @@ -580,7 +582,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "a5d6b066", "metadata": {}, "outputs": [ @@ -603,7 +605,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "c32526fd", "metadata": {}, "outputs": [ @@ -626,7 +628,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "9ab09848", "metadata": {}, "outputs": [ @@ -645,7 +647,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "efd7f828", "metadata": {}, "outputs": [ @@ -664,7 +666,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "b4502821", "metadata": {}, "outputs": [ @@ -688,7 +690,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "2919fe8f", "metadata": {}, "outputs": [ @@ -718,7 +720,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "943f1eb0", "metadata": {}, "outputs": [ @@ -741,7 +743,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "id": "ef8e82ea", "metadata": { "scrolled": true @@ -771,7 +773,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "fa9577fa", "metadata": {}, "outputs": [ @@ -789,7 +791,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "id": "e3e61188", "metadata": {}, "outputs": [ @@ -807,7 +809,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "id": "2adacf28", "metadata": {}, "outputs": [ @@ -825,7 +827,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "id": "2646670b", "metadata": {}, "outputs": [ @@ -843,7 +845,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": null, "id": "caa6e9af", "metadata": { "scrolled": true @@ -861,7 +863,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": null, "id": "34bd5b99", "metadata": {}, "outputs": [ @@ -883,7 +885,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": null, "id": "ae4f0131", "metadata": {}, "outputs": [ @@ -901,7 +903,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": null, "id": "1b9bea43", "metadata": {}, "outputs": [], @@ -911,7 +913,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": null, "id": "c87c3dce", "metadata": {}, "outputs": [ diff --git a/tests/trace-unix-general.ipynb b/tests/trace-unix-general.ipynb index 44612824..332eea80 100644 --- a/tests/trace-unix-general.ipynb +++ b/tests/trace-unix-general.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "d8d3fc06", "metadata": {}, "outputs": [], @@ -14,12 +14,15 @@ "## | Hi?2004l\n", "# bind 'set enable-bracketed-paste off'\n", "\n", + "# Global Setup\n", + "source ~/shell-scripts/tomohara-aliases.bash\n", + "\n", "# OLD & BAD: /bin/rm -rf /tmp/test-unix/test-3245 > /dev/null" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "6dcea75d", "metadata": {}, "outputs": [], @@ -29,7 +32,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "65d43538", "metadata": {}, "outputs": [ @@ -54,7 +57,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "d623c9a9", "metadata": {}, "outputs": [], @@ -71,7 +74,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "a377b19c", "metadata": {}, "outputs": [], @@ -86,7 +89,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "ab954c7f", "metadata": {}, "outputs": [], @@ -124,7 +127,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "ec6df159", "metadata": { "scrolled": true @@ -150,7 +153,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "85787c44", "metadata": {}, "outputs": [ @@ -174,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "15465d13", "metadata": { "scrolled": true @@ -188,7 +191,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "3c57d3b0", "metadata": {}, "outputs": [ @@ -207,7 +210,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "1403d768", "metadata": {}, "outputs": [ @@ -227,7 +230,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "85982448", "metadata": {}, "outputs": [], @@ -237,7 +240,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "2395c71a", "metadata": { "scrolled": false @@ -264,7 +267,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "bc13426e", "metadata": {}, "outputs": [], @@ -288,7 +291,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "b688da20", "metadata": {}, "outputs": [], @@ -309,7 +312,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "775ea494", "metadata": {}, "outputs": [], @@ -344,7 +347,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "88c71418", "metadata": {}, "outputs": [], @@ -358,7 +361,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "6ed9a120", "metadata": {}, "outputs": [ @@ -388,7 +391,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "bf36bf1a", "metadata": {}, "outputs": [ @@ -410,7 +413,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "f7af5f4b", "metadata": {}, "outputs": [ @@ -434,7 +437,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "e73cd7c1", "metadata": {}, "outputs": [], @@ -450,7 +453,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "079b0855", "metadata": {}, "outputs": [ @@ -485,7 +488,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "1e7238c8", "metadata": {}, "outputs": [], @@ -499,7 +502,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "7762153f", "metadata": {}, "outputs": [