Nate Blaylock

27 papers A* 4A 4B 1Misc 2Journal 3Unranked 12
YearRankTypeTitle / Venue / Authors
2024 conf
FICC (1)
Raymond Brueckner, Namhee Kwon, Vinod Subramanian, Nate Blaylock, Henry O'Connell
2024 J jnl
Frontiers Digit. Health
Ruth Bahr, James T. Anibal, Steven Bedrick, Jean-Christophe Bélisle-Pipon, Yael Bensoussan, Nate Blaylock, Joris Castermans, Keith Comito, David A. Dorr, Greg Hale, Christie Jackson, Andrea Krussel, Kimberly Kuman, Akash Raj Komarlu, Jordan Lerner-Ellis, Maria Powell, Vardit Ravitsky, Anaïs Rameau, Charlie Reavis, Alexandros Sigaras, Samantha Salvi Cruz, Jenny Vojtech, Megan Urbano, Stephanie Watts, Robin Zhao, Jamie Toghranegar
2023 A conf
INTERSPEECH
Vinod Subramanian, Namhee Kwon, Raymond Brueckner, Nate Blaylock, Henry O'Connell, Luis Sierra, Clementina Ullman, Karen Hildebrand, Simon E. Laganiere
2023 conf
SMM
Raymond Brueckner, Misa Takegami, Namhee Kwon, Nate Blaylock, Vinod Subramanian, Eri Kiyoshige, Soshiro Ogata, Yuriko Nakaoku, Henry O'Connell, Kunihiro Nishimura
2022 conf
SMM
Namhee Kwon, Shahruk Hossain, Nate Blaylock, Henry O'Connell, Naomi Hachen, Joseph Gwin
2014 ch.
Natural Language Generation in Interactive Systems
Nate Blaylock
2012 conf
IHI
Lucian Galescu, Nate Blaylock
2012 J jnl
Trait. Autom. des Langues
Nate Blaylock, James F. Allen, William de Beaumont, Lucian Galescu, Hyuckchul Jung
2011 conf
BioNLP@ACL
Hyuckchul Jung, James F. Allen, Nate Blaylock, William de Beaumont, Lucian Galescu, Mary D. Swift
2011 conf
ICSC
Nate Blaylock
2011 conf
BCB
Nate Blaylock, William de Beaumont, James F. Allen, Hyuckchul Jung
2010 Misc conf
FLAIRS
Nate Blaylock, William de Beaumont, Lucian Galescu, Hyuckchul Jung, James F. Allen, George Ferguson, Mary D. Swift
2009 Misc conf
FLAIRS
Brandyn Allen White, Nate Blaylock, Ladislau Bölöni
2009 conf
HLT-NAACL (Short Papers)
Nate Blaylock, Bradley Swain, James F. Allen
2006 J jnl
J. Biomed. Informatics
James F. Allen, George Ferguson, Nate Blaylock, Donna K. Byron, Nathanael Chambers, Myroslava O. Dzikovska, Lucian Galescu, Mary D. Swift
2006 A* conf
AAAI
Nate Blaylock, James F. Allen
2006 A conf
ECAI
Tilman Becker, Nate Blaylock, Ciprian Gerstenberger, Ivana Kruijff-Korbayová, Andreas Korthauer, Manfred Pinkal, Michael Pitz, Peter Poller, Jan Schehl
2006 B conf
LREC
Ivana Kruijff-Korbayová, Tilman Becker, Nate Blaylock, Ciprian Gerstenberger, Michael Kaisser, Peter Poller, Verena Rieser, Jan Schehl
2006 A* conf
ACL
Tilman Becker, Peter Poller, Jan Schehl, Nate Blaylock, Ciprian Gerstenberger, Ivana Kruijff-Korbayová
2005 conf
SIGDIAL Workshop
Nate Blaylock, James F. Allen
2005 conf
ENLG
Ivana Kruijff-Korbayová, Nate Blaylock, Ciprian Gerstenberger, Verena Rieser, Tilman Becker, Michael Kaisser, Peter Poller, Jan Schehl
2005 conf
User Modeling
Nate Blaylock, James F. Allen
2004 A* conf
ICAPS
Nate Blaylock, James F. Allen
2003 A* conf
IJCAI
Nate Blaylock, James F. Allen
2003 A conf
EACL
Gregory Aist, John Dowding, Beth Ann Hockey, Manny Rayner, James Hieronymus, D. Bohus, B. Boven, Nate Blaylock, Ellen Campana, Susana Early, Genevieve Gorrell, S. Phan
2002 A conf
AAMAS
James F. Allen, Nate Blaylock, George Ferguson
2002 conf
SIGDIAL Workshop
Nate Blaylock, James F. Allen, George Ferguson
tests/unit/test_apk_apktool_wrapper.py
← Index tests/unit/test_apk_apktool_wrapper.py python
"""
Unit tests for apktool wrapper subprocess management and smali directory detection.

All subprocess calls are mocked — no apktool/Java installation required.
"""
import os
import tempfile

import pytest
from unittest.mock import MagicMock, patch

pytestmark = [pytest.mark.unit, pytest.mark.apk, pytest.mark.decompile]


class TestApktoolDisassembler:
    """Tests for ApktoolDisassembler subprocess wrapper."""

    @patch.dict(os.environ, {}, clear=False)
    def test_init_defaults(self):
        os.environ.pop("APKTOOL_PATH", None)
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        a = ApktoolDisassembler()
        assert a.apktool_path == "apktool"
        assert a.timeout == 120

    def test_init_custom(self):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        a = ApktoolDisassembler(apktool_path="/opt/apktool", timeout=120)
        assert a.apktool_path == "/opt/apktool"
        assert a.timeout == 120

    def test_init_from_env(self):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        with patch.dict(os.environ, {"APKTOOL_PATH": "/usr/bin/apktool", "APKTOOL_TIMEOUT": "90"}):
            a = ApktoolDisassembler()
            assert a.apktool_path == "/usr/bin/apktool"
            assert a.timeout == 90

    @patch("subprocess.Popen")
    def test_disassemble_success(self, mock_popen):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        mock_proc = MagicMock()
        mock_proc.communicate.return_value = ("output", "")
        mock_proc.returncode = 0
        mock_popen.return_value = mock_proc

        a = ApktoolDisassembler()
        result = a.disassemble("/test.apk", "/output")
        assert result is True

    @patch("subprocess.Popen")
    def test_disassemble_failure(self, mock_popen):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        mock_proc = MagicMock()
        mock_proc.communicate.return_value = ("", "error")
        mock_proc.returncode = 1
        mock_popen.return_value = mock_proc

        a = ApktoolDisassembler(log=MagicMock())
        result = a.disassemble("/test.apk", "/output")
        assert result is False

    @patch("subprocess.Popen")
    def test_disassemble_timeout(self, mock_popen):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        import subprocess
        mock_proc = MagicMock()
        mock_proc.communicate.side_effect = subprocess.TimeoutExpired(cmd="apktool", timeout=10)
        mock_proc.pid = 12345
        mock_popen.return_value = mock_proc

        with patch("os.getpgid", return_value=12345), \
             patch("os.killpg"):
            a = ApktoolDisassembler(timeout=10, log=MagicMock())
            result = a.disassemble("/test.apk", "/output")
            assert result is False

    @patch("subprocess.Popen", side_effect=FileNotFoundError)
    def test_disassemble_not_found(self, mock_popen):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        a = ApktoolDisassembler(log=MagicMock())
        result = a.disassemble("/test.apk", "/output")
        assert result is False

    @patch("subprocess.Popen")
    def test_disassemble_command_args(self, mock_popen):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        mock_proc = MagicMock()
        mock_proc.communicate.return_value = ("", "")
        mock_proc.returncode = 0
        mock_popen.return_value = mock_proc

        a = ApktoolDisassembler(apktool_path="/opt/apktool")
        a.disassemble("/test.apk", "/output")

        cmd = mock_popen.call_args[0][0]
        assert cmd[0] == "/opt/apktool"
        assert "d" in cmd
        assert "--no-res" in cmd
        assert "--force" in cmd
        assert "/test.apk" in cmd

    def test_get_smali_directories_single_dex(self):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        with tempfile.TemporaryDirectory() as tmpdir:
            os.makedirs(os.path.join(tmpdir, "smali"))
            a = ApktoolDisassembler()
            dirs = a.get_smali_directories(tmpdir)
            assert len(dirs) == 1
            assert dirs[0].endswith("smali")

    def test_get_smali_directories_multi_dex(self):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        with tempfile.TemporaryDirectory() as tmpdir:
            os.makedirs(os.path.join(tmpdir, "smali"))
            os.makedirs(os.path.join(tmpdir, "smali_classes2"))
            os.makedirs(os.path.join(tmpdir, "smali_classes3"))
            # Should not be included
            os.makedirs(os.path.join(tmpdir, "res"))
            os.makedirs(os.path.join(tmpdir, "original"))

            a = ApktoolDisassembler()
            dirs = a.get_smali_directories(tmpdir)
            assert len(dirs) == 3

    def test_get_smali_directories_empty(self):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        with tempfile.TemporaryDirectory() as tmpdir:
            a = ApktoolDisassembler()
            dirs = a.get_smali_directories(tmpdir)
            assert dirs == []

    def test_get_smali_directories_nonexistent(self):
        from redb.extractors.decompiler.apk.apktool_wrapper import ApktoolDisassembler
        a = ApktoolDisassembler()
        dirs = a.get_smali_directories("/nonexistent/path")
        assert dirs == []