A client who is HIV-positive, has pneumonia and is not responding to antibiotic therapy may have active pulmonary tuberculosis (TB) due to exposure history and symptoms of night sweats and hemoptysis. Which test is the most reliable to confirm the diagnosis of active pulmonary TB?