Accurate goodness-of-fit tests for the extreme tails of empirical distributions is a very important issue, relevant in many contexts, including geophysics, insurance, and finance. We have derived exact asymptotic results for a generalization of the large-sample Kolmogorov-Smirnov test, well suited to testing these extreme tails. In passing, we have rederived and made more precise the approximate limit solutions found originally in unrelated fields, first in [L. Turban, J. Phys. A 25, 127 (1992)] and later in [P. L. Krapivsky and S. Redner, Am. J. Phys. 64, 546 (1996)].